Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    using find and grep with pipe


    I would like to search for a text in a file using find and grep command. For that I used following command

    find ./ -name *.C -exec grep "using namespace cem" {} \; -print

    and it worked correctly.

    Just wondering why following command fails to do the same any pointers would be appreciated..

    find ./ -name *.C | gerp "using namespace cem"


  2. #2
    Linux User
    Join Date
    Jul 2004
    "I don't know what I'm running from
    And I don't know where I'm running to
    There's something deep and strange inside of me I see"

  3. #3
    Could it be gerp instead of grep?

  4. $spacer_open
  5. #4
    Assuming the 'gerp' was just a typo in your post the problem is you're searching the filenames and not the text within the files. Try this:

    find ./ -name *.C | xargs grep "using namespace cem"

Posting Permissions

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