Hi friends,
It gives me 3 lines in output which contain word "automation".
But along with it I want the script to return file name from which it got the word.
How to do it?
Plz guide me
Anu
Can you please show your script?
If you are searching in multiple file, grep would by default display the filename.
for count in `cat RAM_*`
do
cat $count | grep "automation"
done
Please try
grep "automation" $(cat RAM_*)
You should get the filenames with this
---------- Post updated at 05:43 PM ---------- Previous update was at 05:33 PM ----------
If you just want to print the file name before the matching lines
for count in `cat RAM_*`
do
echo $count
grep "automation" $count
done
Hey THanks Anchal, Its working.
Thanks once again to all buddies who attempted my query.