Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


  Search this Thread
Old 06-20-2005, 11:47 AM   #1
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, 12:02 PM   #2
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30

grep <keyword> *.(file extension)
Old 06-20-2005, 03:00 PM   #3
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


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

All times are GMT -5. The time now is 11:17 PM.

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