Example of using each line of a file in a bash script
ladmin@DESKTOP-ANGABGS:~$ cat this.file
8.8.8.8
8.8.4.4
9.9.9.9
ladmin@DESKTOP-ANGABGS:~$ cat rollthrough.sh
#!/bin/bash
filename='this.file'
echo Start
while read p; do
ping -c 2 "$p"
done < "$filename"
ladmin@DESKTOP-ANGABGS:~$
working example to compare two files for a matching line
#!/bin/bash
filename='master.log'
echo Start
while read p; do
final=`cat this.file |grep -c "$p"`
if [ $final -eq 1 ]
then
echo $p" - SALTO STATUS - reported as being - UP"
else
echo $p" - SALTO STATUS - reported as being - DOWN"
fi
done < "$filename"