I have a daily report in the csv file format of a list of public IP address and I need to to fill in the Hostname for the public IP. The Hostname can be an OrgId or netname.
I need to do a bash script to automate the whois search instead of searching manually one by one and filling it up on the csv file.
Example: This is an excerpt of a long list of Public IP address
Port,Type,S_Host,S_IP,Port,D_Host,D_IP,Port
2,tcp,N/A,8.8.8.8,2,N/A,47.246.57.232,8
3,tcp,N/A,47.246.57.232,2,N/A,217.17.81.9,3
I need to do a whois search on the IPs in column 4 and 7 then, fill in the Hostname inside field 3 and 6.
Desired output:
Port,Type,S_Host,S_IP,Port,D_Host,D_IP,Port
2,tcp,Google,8.8.8.8,2,Alibaba,47.246.57.232,8
3,tcp,Alibaba,47.246.57.232,2,MVTV,217.17.81.9,3