I am trying to find out which files in a group of files have lines ending in r. What I have is this:
cat /tmp/*RECORDS| if grep r$>/dev/null; then echo "yes";else echo"no";fi
Records is more than one file. There are the following files
TEST-RECORDS
/volume/testing
/volume/programs
INFO-RECORDS
/volume/101r -example of line that ends in r
/volume/listingr
CATALOG-RECORDS
/volume/catar
/volume/catx
I was trying to use this command to find out which Records had "r" but of course it returns yes when run because if even one file has a volume ending in R it would return "yes."
If I do this:
for i in `cat /tmp/*RECORDS`; do if $i grep $r>/dev/null; then echo "yes";fi;done
Then I get a load of messages "no such file or directory" and the names of the files.
I am really just trying to find out which of these files has a line ending in r, and then print yes for just that file, but I am stuck.
Does anyone have any ideas?