Find the answer to your Linux question:
Results 1 to 2 of 2
I want to use grep to search for a single script in every directory and every file that is readable by my pc. Could someone help me with this?...
  1. #1
    Just Joined! errigour's Avatar
    Join Date
    Jan 2009
    Posts
    51

    how do I use grep write?

    I want to use grep to search for a single script in every directory and every file that is readable by my pc. Could someone help me with this?

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    man grep
    /recursive

    scroll up to see full option

    -d ACTION, --directories=ACTION
    If an input file is a directory, use ACTION to process it. By
    default, ACTION is read, which means that directories are read
    just as if they were ordinary files. If ACTION is skip, direc-
    tories are silently skipped. If ACTION is recurse, grep reads
    all files under each directory, recursively; this is equivalent
    to the -r option.



    grep -r "regular expresion" /
    note however you will get a LOT of errors, luckily, stderr and stdout are 2 different thigs, I suggest

    egrep -r "regular expresion" / > ~/some_file

    this will place your results in a txt file under your home directory named "some_file"
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...