Hi,
I used grep command to search for names in a file and it's code is
match=$(grep -c "$output1" outputfiles.txt )
if [ $match = 0 ]
then
echo $match
else
echo "match is geater than 1"
fi
where output1 is variable containing those names and outputfiles.txt is the file name. I tried this by using two strings:
- prod_rel_post_entr_au_interface-08_10_03.csv 3 times
- au_interface-08_10_03.csv 1 time
but my code is giving me 0 for only one time though there should be two 0s in the output
I think grep command is taking both names similar coz au_interface-08_10_03.csv part is present in prod_rel_post_entr_au_interface-08_10_03.csv.
Can anybody help me with this PLEASE
I also checked man grep but it didn't help me.