Solved

grep "expression or expression" file

Posted on 2001-06-13
4
254 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

19 Experts available now in Live!

Get 1:1 Help Now