LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bash: how to edit cat <filename> | grep <keyword> feature? (https://www.linuxquestions.org/questions/linux-software-2/bash-how-to-edit-cat-filename-%7C-grep-keyword-feature-335433/)

sirpelidor 06-20-2005 11:47 AM

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 :)

Nobber 06-20-2005 12:02 PM

Try

grep <keyword> *.(file extension)

sirpelidor 06-20-2005 03:00 PM

cool, that does the trick, thanks Nobber


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