I have a text file (num.txt) with contents like:
457878600
575909798
767909780
.
.
and another file (data.txt) has data related to some of the above numbers.
I need to grep each number from num.txt on data.txt file to check if the data related to that number exist in the file or not
if exists continue with next nbr
if does not exist need to run a command
can any one suggestme how the above verification can be done using if else?
:wall:
while read line
do
grep "$line" data.txt > /dev/null
if [ $? -eq 0 ]
then
echo "$line number present in data file"
else
echo "$line number not present in data file"
<<< execute the command u need >>>
fi
done<num.txt