Ramin Hossaini (blog)

4Nov/09

Search through files for a string (Linux)

To search a directory recursively for specific text or a string, use:

find . -exec grep "string to find" '{}' \; -print

Related posts:

  1. Recompile invalid objects in an Oracle schema
  2. Performing WordPress upgrades (Linux)
  3. Extracting attachments from .EML files
  4. Linux: Tar and Zip
  5. Facebook lacks a simple feature
Tagged as: Leave a comment
Comments (1) Trackbacks (0)
  1. When searching for something very specific like an error code, I use what you’ve describe here.

    When searching for a term where I’m simply guessing might be relevant, I typically use the -l flag with grep to just print the file name rather than the match. Usually the path or name gives me a good idea about whether the file is relevant. I’ll pick the more relevant files to use grep for searches inside.


Leave a comment

(required)

No trackbacks yet.

Bear
Private