Armed with my new knowledge, I processed all 35,000 lines of the source file so as to separate one file with the original four-octet-containing hostnames and four additional columns each containing one of those four octets. That list of IPv4's is 3500 lines long, out of 14,000 hosts that were up at the time of the scan of 22,500 rows scanned plus 5,000 rows that were accounted for; about 7,500 were not up at the time of the scan.

About 5,000 rows were cast aside by nMap as unresolvable; the 3500 lines came from those 5,000 rows.

Now my task is to create just two columns of data from the current five-column file. The following command
does not quite do that successfully:

awk -f beginning-5-col-file.txt '{ print $1"\t"$2"\:"$3"\:"$4"\:"$5 }' > output-2-column-file.txt

[awk finds a decimal pint that it doesn't like, but the only decimal points are in the first column of the input file as parts of the hostnames ... looks like I need to use printf instead ... all five columns
will have to be formatted as strings to shield those dots from prying eyes]

I'm using colons (:) as the field separator here with the intent to replace the colons with decimal points by using search-and-replace-all in Leafpad; there are no colons in the hostname column. The final output file can then be processed with an nslookup script to make sure the octets are in the correct order and not reversed. An awk script could compare the hostnames of the IPv4 column to the first column's hostnames and then reverse the octet order of the ones that fail that test before trying again.

Reply via email to