Solved

grep command two patterns

Posted on 2004-08-11
2
608 Views
Last Modified: 2010-04-21
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
Comment
Question by:bt707
2 Comments
 
LVL 11

Accepted Solution

by:
griessh earned 500 total points
ID: 11772165
Hi bt707,

grep 1st file1 | grep 2nd

======
Werner
0
 

Author Comment

by:bt707
ID: 11772270
that did it, thanks a lot
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now