I have an input file with a list of random IP addresses, each on a new line. Below is just an example as I omitted the real IP addresses for obvious reasons.
Basically what I would like to do is to take all the IP addresses in the input file and pipe them into an output file eg. zgrep_ip.sh which in essence is a formatted zgrep command from the input file.
Correct, the file containing the list of IP's is called random_ip.txt, not sure why your script is not picking it up? I executed your script from within the directory where the random_ip.txt file reside.
Hmmm... It works for me. Not sure why it doesn't work for you.
May be, some random control characters have crept in either your script file or input file.