• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 628
  • Last Modified:

grep command two patterns

can't get this right for some reason:

I want to do a search for any line that contains two differnt items, must contain both, when I do a search I still get all lines that
contain one or the other or both, I want only the lines that contain Both.

Ex:

I use this command and it works but gives me all lines that contain either word.

grep 1stWord 2ndWord -e file1


Thanks,

0
bt707
Asked:
bt707
1 Solution
 
griesshCommented:
Hi bt707,

grep 1st file1 | grep 2nd

======
Werner
0
 
bt707Author Commented:
that did it, thanks a lot
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now