Say I want to find all files that mention "Jonathan Appleseed" in a Linux system.
I see examples using grep, but I can't quite grep yet how to search (all directories from HERE). So I want to look in everything below /var/, for example
|
feedback
|
|
haha. It will take hours :> in any case .... | |||||||||||||
feedback
|
|
If your grep doesn't have the -R option,
will generally do what you're asking. | |||||||
feedback
|
|
word = word that you want to search, if you want to search a phrase enclose between two single quotes
or
combining find with grep allow you to make more accurate search combining grep content search with find file search, this is the avalaible option for find :
For Search "Jonathan Appleseed" in /var dir under linux, i do something like this :
for search .txt file that contain term "Jonathan Appleseed", you cold do this :
| ||||
feedback
|
You're looking for:
If you want to run a command on all matching files, I would suggest:
Note that -l means show only the filename (not matching text), -r means recursive, and -z (if you choose to use it) means the file names are null ("\0") terminated rather than terminated with a carriage return. This means xargs can handle filenames with spaces, tabs, and carriage returns in the name more readily. I also am passing / to indicate that grep should start at the root of the filesystem ("all files... in a Linux system.") | |||
|
feedback
|