Need to tracert IP range & save 2nd line of output to file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Grepawking
Posts: 3
Joined: 20 Mar 2014 12:43

Need to tracert IP range & save 2nd line of output to file

#1 Post by Grepawking » 20 Mar 2014 12:51

I'm very inexperienced with batch commands and scripting but what I want to do is is run the tracert command on a number of IP address ranges (192.168.1.1 - 192.168.1.255) as well as some other address ranges (I would like to save the ranges into a text file from which to inject into the batch/script).

When I run the tracert command, the first new line is blank and then on the second line there is information that I need to save into the file and then the command should be terminated. After this command runs I need it to run the next number in the range.

Where is a good place to start to figure out what I need to make this possible. Is this a batch file or a script?
Last edited by Grepawking on 20 Mar 2014 15:26, edited 1 time in total.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Need to tracert IP range & save 2nd line of output to fi

#2 Post by Squashman » 20 Mar 2014 13:10

Just wondering if you already tried using Grep and Awk to do this?

Grepawking
Posts: 3
Joined: 20 Mar 2014 12:43

Re: Need to tracert IP range & save 2nd line of output to fi

#3 Post by Grepawking » 20 Mar 2014 15:23

:D Linux doesn't resolve the hostname of the IP the same way that DOS does, at least I haven't found a way to do it - thus I'm having to do this on a windows machine.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Need to tracert IP range & save 2nd line of output to fi

#4 Post by Squashman » 20 Mar 2014 16:06

Grepawking wrote::D Linux doesn't resolve the hostname of the IP the same way that DOS does, at least I haven't found a way to do it - thus I'm having to do this on a windows machine.

That doesn't answer my question.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Need to tracert IP range & save 2nd line of output to fi

#5 Post by penpen » 20 Mar 2014 17:04

Grepawking wrote::D Linux doesn't resolve the hostname of the IP the same way that DOS does, at least I haven't found a way to do it - thus I'm having to do this on a windows machine.
If you only want to resolve hostnames of a given IP, then why don't you use nslookup.
Should be the default program name for all oses (DOS, Win, Linux, Mac, ... all versions).

penpen

Grepawking
Posts: 3
Joined: 20 Mar 2014 12:43

Re: Need to tracert IP range & save 2nd line of output to fi

#6 Post by Grepawking » 20 Mar 2014 18:43

penpen wrote:
Grepawking wrote::D Linux doesn't resolve the hostname of the IP the same way that DOS does, at least I haven't found a way to do it - thus I'm having to do this on a windows machine.
If you only want to resolve hostnames of a given IP, then why don't you use nslookup.
Should be the default program name for all oses (DOS, Win, Linux, Mac, ... all versions).

penpen


I just found that and it makes everything much easier. Thanks for the suggestion.

Post Reply