How to Identify files with sed command contained in text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grinder332518
    New Member
    • Jun 2009
    • 28

    #1

    How to Identify files with sed command contained in text

    Hi

    My home directory contains lots of files with differing contents and extensions.
    I wish to identify all those files containing a sed command in the text.
    I thought I could use something like
    Code:
              find . –print | grep “ sed “
    ,

    but this seems to look for files with “ sed “ in the filename, not in the contents.

    Can anyone help ?
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #2
    you can use,

    grep -rin "sed" *

    This will do a recursive search for pattern "sed" in each file.

    Comment

    • grinder332518
      New Member
      • Jun 2009
      • 28

      #3
      Thanks Ashitpro : your solution works great for me.

      Comment

      Working...