[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Grep Options



SoloCDM wrote:
> 
> While using grep, what is the best way to search for two subjects
> within the same line instead of the following?
> 
> cat <filename> | grep <subject_one> | grep <subject_two>
> 
> This is not an "or" search with "-e", but an "and" search.

grep "^Subject:.*subject1.*subject2" filename

-- 
Anthony E. Greene <agreene pobox com> <http://www.pobox.com/~agreene/>
PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
Linux. The choice of a GNU Generation. <http://www.linux.org/>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]