I'm using bash under Ubuntu.
Currently this works well for the current directory:
catdoc *.doc | grep "specificword"
But I have lots of subdirectories with .doc files.
How can I search for, let's say, "specificword" recursively?
bashcatgreplinux
I'm using bash under Ubuntu.
Currently this works well for the current directory:
catdoc *.doc | grep "specificword"
But I have lots of subdirectories with .doc files.
How can I search for, let's say, "specificword" recursively?
Best Answer
Use
find
for recursive searches:This will also output the file name:
(Normally I would use
find ... -print0 | while read -rd "" file
, but there's maybe a .0001% chance that it would be necessary, so I stopped caring.)