The find command is used to find files in a Unix/Linux system. The grep command is used to find text within files and output. The xargs utility is used to combine commands together. This is a demonstration of using all three to search for specific text within files recursively through the directory tree.
find . | xargs grep my string -risl
r tells the system to perform the search recursively.
i tells it to ignore cases.
s tells it to suppress error messages.
l lets it know we only want matching filenames.
You can also send the output to a file since sometimes the lists can be very long. Once in the file it can easily be browsed using VIM or you can even grep it again.
find . | xargs grep my string -risl > /mylist.grep
Related posts:
Wouldn’t it be easier to type “grep -ril “search term?
r = recursive
i = ignore case
l = only list the file name not “file name:matching line?
sorry it should read “grep -ril search_term *?
Hi, i think that i saw you visited my site so i came to “return the favor”.I’m trying to find things to enhance my website!I suppose its ok to use some of your ideas!!