Suppose there are multiple files containing certain text "abc". How to print the name of all such files with a single command from unix prompt?
Thanks in advance
Suppose there are multiple files containing certain text "abc". How to print the name of all such files with a single command from unix prompt?
Thanks in advance
grep -l abc *
will this serve the purpose?
i expected if to use find, xargs and print combination ..... what say????
If want it recursive (with GNU grep):
grep -Rl abc *
you can go to the folder and run the below one-liner which list out the files
grep -s "abc" * | cut -d : -f1 | uniq
-ilan
PS:editing my post; as it is a late commit
The same is true for the AIX grep: "-R" is "recursive without following links", "-r" is "recursive including following links". This can be fine tuned by using the "-H" and the "-L" option together with -r/-R.
bakunin
find /full/path -type f -exec grep -l "abc" "{}" \;