I want to create a script using sh to read a text file with a list of IP's and run a single command with that list on each. I would like my script to grab the IP as a variable so that I can fiddle with it in the script but I'm not sure of how to go about getting the script to '
read' each line then run the command and loop for each entry.
So for example...
Command would be something like this:
dig @abc.com axf 123.com | grep '$ip'
and the text file would contain something like...
1.1.1.1
2.2.2.2
3.3.3.3
4.4.4.4
Please help. I'm novice at scripting so I'm sure there's a word for it but I don't know what it is to do the necessary search here in the forum. Please advise on how best to implement (array,sed,awk, exec, etc. etc.). Not looking to get spoon fed, just looking for some direction.