find starting_folder -name "*" | grep -i file_name | xargs grep -i search_string
for example:
"find . -name "*" | grep -i hobba | xargs grep -i tito"
searches for the string "tito" inside all files whose name contains the word "hobba" inside the current folder.
Note that the "-i" parameter for the "grep" command makes the search case insensitive.
Subscribe to:
Post Comments (Atom)
2 comments:
Great usage of the command line.
We also can achieve the same result using the following command :
grep -iR tito *hobba*
But if we want to search files contains hobba that may be HoBBa or HobbA (i.e search files itself case sensitivity ), we should use your command. with -iname instead of -name
Thanks for your sharing of valuable information.
Post a Comment