?
Solved

grep "expression or expression" file

Posted on 2001-06-13
4
Medium Priority
?
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
amitpagarwal earned 200 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

Technology Partners: 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!

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
In this post we will learn different types of Android Layout and some basics of an Android App.
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, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

741 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