About
Pricing
Community
Teams
Start Free Trial
Log in
bje
asked on
3/6/2015
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-Other
Scripting Languages
3
1
Last Comment
bje
8/22/2022 - Mon
ozo
3/6/2015
file=testfile.abc
if grep -x "filename - $file" /temp/checkfile.dat;
then
do something
else
do someting
fi
ASKER CERTIFIED SOLUTION
Gerwin Jansen
3/7/2015
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
3/9/2015
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
if grep -x "filename - $file" /temp/checkfile.dat;
then
do something
else
do someting
fi