ultimately I am looking to insert some info into a database. So I'm trying to output a file from something (probably nmap) that is formatted like this:
10.1.150.1,Up,1/3/2012,host.domain.lan 10.1.150.2,Down,1,3/2012,host2.domain.lan
I do not HAVE to get the date from the nmap scan but it would be helpful. I can add it when I insert the data into the DB.
I'm pretty sure that nmap can do this along with some grep, awk, and sed foo, but those things aren't my strongest points.
EDIT: I'm open to suggestions about output formats.. XML? I need to run this daily (give or take) and import the results to MySQL
EDIT2: I've gotten this far;
nmap -sn -oG - 192.168.0.50-100 | grep Host | awk '{print $2","$5","$3}'
Which gives me this:
192.168.0.75,Up,() 192.168.0.76,Up,(server01.domain.com) 192.168.0.77,Up,(server02.domain.com) 192.168.0.78,Up,(server03.domain.com)
Next; Can I remove the parens? add the date? Nmap always says what time it starts and finishes but it doesn't include that on each line... so I can't grab it w/ the awk statement.