Avatar of bje
bje
Flag for United States of America asked on

How to check a file against a table

hello,
I would like to check a file against a table (file name.dat)

 filename - testfile.abc
 table (file name called ) - checkfile.dat  ( the checkfile.dat would have several file names in it )

If file called testfile.abc is in checkfile.dat then do this or if it does not then do this

would this work,

if [ ` grep -c -f /temp/checkfile.dat $file ` -ne 0 ]
 then
    do something
else
  do someting
fi
Programming Languages-OtherScripting Languages

Avatar of undefined
Last Comment
bje

8/22/2022 - Mon
ozo

file=testfile.abc
if grep -x  "filename - $file" /temp/checkfile.dat;
then
    do something
else
  do someting
fi
ASKER CERTIFIED SOLUTION
Gerwin Jansen

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
bje

ASKER
Thank you for both solutions.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck