How do i get
from the following files?
Your help would be much appritiated.[/QUOTE]
Using the for loop, the entire contents of the Syslog file will appear in the command line. That's awkward for large files. Here's a way that reads one line at a time.
while read ipaddress
grep "$ipaddress" Inventory
done < Syslog > outputfile
It's more readable, too. The quotes around the first grep argument are there in case there are spaces. Notice both methods are vulnerable to hostile input. If there are semicolons, backtics, parentheses etc in the Syslog file they will be interpreted by the shell. Beware that your file doesn't contain a line like
220.127.116.11; rm -r /usr/lib