Solved

grep "expression or expression" file

Posted on 2001-06-13
4
265 Views
Last Modified: 2013-12-26
hi .

I have some kind of desired lines at the log file :
---> Time   17.217us: Receiving preamble on GMII
---> Time   17.585us: Packet Received from port 2
---> Time   13.478us: Sending Pkt on GMII
...
the key words are :

Receiving , Received , Sending

how to write a grep command to get as an expression : "exp1 or exp2 or exp3"

can I do this with larger groups of key words ?

Talmash


0
Comment
Question by:Talmash
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
amitpagarwal earned 50 total points
ID: 6185442
you could actually use egrep

egrep "exp1|exp2|exp3" fileName


or use grep in the following manner

grep -e pattern1 -e patter2 ...fileName
0
 
LVL 6

Author Comment

by:Talmash
ID: 6185636
hi .

tnx ,

grep -e pattern1 -e patter2 ...fileName

didn't worked

egrep "exp1|exp2|exp3" fileName

worked just fine .

was -e flag do ?

Talmash
0
 
LVL 5

Expert Comment

by:amitpagarwal
ID: 6185771
i say the -e pattern in teh man page of grep .. i guess only the latest version of grep may be supporting it.

Thanks.
0
 
LVL 6

Author Comment

by:Talmash
ID: 6186013
again ,

tnx

Talmash
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

17 Experts available now in Live!

Get 1:1 Help Now