Using the results of locate for grep
Let's say that I do a locate command to find all txt files:
ex. locate .txt How can I use the results in a grep command (to search what is in the files)? For example: I use locate to find all text files and in each of those text files, I want to find the name "mike" with grep. Thanks in advanced -Mike |
This is one way:
locate *\.ksh | xargs grep -l 'mike' The -l makes sure you only see a hit once. |
All times are GMT -5. The time now is 06:04 PM. |