How I can make the grep command locate certain words in the files specified by the routes found by the locate command?
locate my.cnf | grep user
(I want that grep command search the word "user" on the files found for locate command)
|
How I can make the grep command locate certain words in the files specified by the routes found by the locate command?
(I want that grep command search the word "user" on the files found for locate command) |
||||
|
|
If your search results are sure to return paths with no spaces, you could use
However you should get in the habit of protecting yourself to handle the case where a path or filename might contain a space by telling
This would work even if your path included blanks like |
|||||||||
|
|
One-liner:
If you want to search pattern in files under the directory name you got from locate then |
||||
|
|
|
If I understand correctly, you could do something like this:
This searches the files matching the |
|||||||||||||
|