Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

grep "expression or expression" file

Posted on 2001-06-13
4
Medium Priority
?
307 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Loops Section Overview

610 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