LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-20-2005, 10:47 AM   #1
sirpelidor
Member
 
Registered: Oct 2003
Location: Madison
Distribution: mdk 8.2, 9.0, 9.2, slack 9.1
Posts: 403

Rep: Reputation: 30
bash: how to edit cat <filename> | grep <keyword> feature?


Hi, I found myself run into this situation quite often:

looking for certain keyword in a pile of file.

e.g: cat *.(file extension) | grep <keyword>

problem is, the result doesn't tell me which file(s) has the keyword i'm looking for. rather it shows a list of lines with the keyword.

where can I edit, so when i issue cat *.xxx | grep yyy would shows me which xxx that yyy is located?

thank you
 
Old 06-20-2005, 11:02 AM   #2
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Try

grep <keyword> *.(file extension)
 
Old 06-20-2005, 02:00 PM   #3
sirpelidor
Member
 
Registered: Oct 2003
Location: Madison
Distribution: mdk 8.2, 9.0, 9.2, slack 9.1
Posts: 403

Original Poster
Rep: Reputation: 30
cool, that does the trick, thanks Nobber
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
logrotate log files - keeping in order when using grep or cat and bash dmellem Linux - Software 6 02-11-2005 01:05 PM
output to a file - cat? grep? Godsmacker777 Linux - Newbie 6 12-08-2004 10:06 AM
Bash - Strip Spaces from string then cat cmfarley19 Programming 8 07-25-2004 12:01 PM
Is this a valid command? find ./ -name bash.bashrc | cat davidas Linux - Newbie 11 04-06-2004 02:16 AM
bash: /bin/cat: cannot execute binary file inTUXicated Linux - General 9 08-06-2003 07:56 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration