I would like to search particular words in specific files by using grep command
example:
file1.txt
this is denver
file2.txt
denver is good city to live in
file3.txt
this is situated in Colorado
please correct me wherever I am wrong
find . -name “file*.txt” | grep -w “denver”
modserv
#2
If you want to pipe find with another command, you have to use the “exec” option, try this:
find . -name "file*.txt" -exec grep -w "denver" {} \;
2 Likes
111
#3
Try this too, hope it will work out…
# grep -w "denver" $(find . -name "file*.txt)
1 Like