I'd like to find the files in the current directory that contain the text "chrome".
$ find . -exec grep chrome
find: missing argument to `-exec'
What am I doing wrong?
|
I'd like to find the files in the current directory that contain the text "chrome".
What am I doing wrong? |
||||
|
You missed a
or
|
|||||||||||||||||||||
|
|
You don't need to use
...or even recursively for folder and everything under it:
|
|||||||||||||
|
you can also do:
The first shows you the lines in the files, the second just lists the files. Caleb's option is neater, fewer keystrokes. |
|||||||||||||||||||||
|
|
Find is one way and you can try
It will search chrome in all files (include sub directories) and it is faster than find |
||||
|
|
|
To see list of files instead of lines:
or:
|
|||
|
|
|
Here's an example of how I usually use find/exec...
This searches recursively for all .py files, and for each file print(s) out the filename and fgrep's for 'hello' on that (for each) file. Output looks like (just ran one today):
|
|||||
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
find: Only one instance of {} is supported with -exec ... +– Costa Apr 3 '17 at 19:36