Re: find'ing files containing certain words (all of them) ...
Hi.
On Sat, 21 Sep 2013 21:12:36 +0300
Alexander Kapshuk <alexander.kapshuk@gmail.com> wrote:
> I could be wrong, but doesn't egrep, which supports extended regular
> expressions, fit the bill?
>
> =; echo two words > grep-AND-test1
> =; echo two > grep-AND-test2
> =; echo words >> grep-AND-test2
>
> =; egrep 'two|words' grep-AND-test*
> grep-AND-test1:two words
> grep-AND-test2:two
> grep-AND-test2:words
You're wrong indeed, as '|' means 'or', not 'and'.
$ echo two > grep-AND-test3
$ egrep 'two|words' grep-AND-test3
two
Please note that 'two.*words' won't be the solution (as 'words' can be
placed before 'two'), and even '(two.*words|words.*two)' won't be the
solution either ('two' and 'words' can be in a different rows of file).
Reco
Reply to: