简体   繁体   中英

How can I search multiple files for a single word or phrase using grep and strings?

Im trying to look for a word like "numbers" in multiple files not just txt files using terminal. I have tried strings -r /media/E016-5484/* | grep numbers But it still doesn't work !

let say you are looking for 1234 in all files which in name contain file_pattern

 grep 1234 ` find . -name "*file_pattern*"`

or

 find  . -name "*file_pattern*" -exec grep 1234 {} \;

If I am not mistaken, you are looking for grep numbers -r /media/E016-5484

From the manpage:

-r, --recursive

Read all files under each directory, recursively, following symbolic links only if they are on the command line. This is equivalent to the -d recurse option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM