Question

I would like to find a particular string in two text files - I know how to do it in a single file, but how do I select more than one file, the example below does it for a single text file, I want to search file myfile.txt and otherfile.txt

grep "redeem" /home/tom/myfile.txt
Was it helpful?

Solution

You can do like this,

grep 'redeem' file1 file2 file3..

Syntax:

grep [OPTIONS] PATTERN [FILE...]

Normally, grep can do the pattern matching in more than one files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top