[TAG] Searching for multiple strings/patterns with 'grep'

Kapil Hari Paranjape kapil at imsc.res.in
Mon Jun 23 11:06:12 MSD 2008


Hello,

On Mon, 23 Jun 2008, Amit k. Saha wrote:
> I have a text file from which I want to list only those lines which
> contain either pattern1 or patern2 or both.

	grep -e '(pattern1)|(pattern2)'
or
	grep '\(pattern1\)\|\(pattern2\)'


Regards,

Kapil.
--





More information about the TAG mailing list