LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-27-2005, 07:57 AM   #1
smart_sagittari
LQ Newbie
 
Registered: Apr 2005
Posts: 26

Rep: Reputation: 16
egrep multiple files


I have a set of files in a directory [unfortunately with a different name]. I would like to search for a pattern amongst these. I know which are the files I am searching in. My question is, how do I feed egrep these multiple file names.

Say, a directory has files a, b, c, d and e.

I am searching for the patterns "hello" and "how" in the files b, c, and e. How do I use the egrep command to go about it.

Code:
egrep -h "hello|how" <something>
What is that <something>?

PS: An alternate solution using a different command is also welcome, provided it is a single command.
 
Old 06-27-2005, 08:04 AM   #2
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
Easy enough:

egrep -h "hello|how" a b c d e

Most of the standard commands let you specify multiple filenames.
 
Old 06-27-2005, 08:57 AM   #3
smart_sagittari
LQ Newbie
 
Registered: Apr 2005
Posts: 26

Original Poster
Rep: Reputation: 16
Quote:
Originally posted by trevelluk
Easy enough:

egrep -h "hello|how" a b c d e

Most of the standard commands let you specify multiple filenames.
Thanks buddy! How strange the mind fails to identify things which are just too obvious. Thanks a lot anyway!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
egrep question internal_war Linux - Newbie 6 05-05-2005 06:32 PM
Help with egrep smart_sagittari Linux - Newbie 2 05-02-2005 08:18 AM
Using Grep and Egrep linux-nerd Linux - General 5 10-10-2004 11:37 AM
Help I need help tarring multiple files in multiple directories VisionZ Linux - Newbie 28 03-25-2004 05:25 PM
Using egrep Barbarian Programming 5 10-20-2002 02:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration