I have a shell script that currently pulls data from a mysql database and writes it to a .csv file. The problem is I would like to do a whois lookup against each public IP to see where they are coming from. I basically have two firewalls writing syslog data to a mysql database and want to make sense of the data.

.csv data output

"2010-04-21 00:04:43","","1120","445"
"2010-04-21 00:17:16","","14","1080"
"2010-04-21 00:17:07","","12","8000"
"2010-04-21 05:12:12","","10","22"
"2010-04-21 05:12:12","","10","22"
"2010-04-21 09:26:51","","8","1434"

Thanks in Advance,


try this where one.csv is your file and it will create a file with the IP address as the name with the whois data,

for x in `cat one.csv  | sed s/\"//g | awk -F, {' print $2 '} `; do  whois $x > $x; done