How to find a keyword in a list of files (recursive) ?

Submitted by Jochus on Thu, 29/04/2010 - 22:03 | Posted in: Lifetime

Arghhh ... everytime I need this, I always have to Google it. Dunno why, but I'm not able to remember it :-). I want to have a list of files (just the path/name) which contain that keyword

The correct command is:

$ find . | xargs grep '##KEYWORD_YOU_WANT_TO_LOOKUP##' -sl 

Comments

Submitted by Paul Praet (not verified) on Sun, 06/06/2010 - 23:06
 

Why not simply do

 grep -r ##KEYWORD## *
?

Submitted by Jochus on Mon, 07/06/2010 - 18:23
 

Ahhh, I didn't know that one :-). Thanks!

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.