Results 1 to 4 of 4
Hi,
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-16-2004 #1Just Joined!
- Join Date
- Dec 2004
- Posts
- 2
using find and grep with pipe
Hi,
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"
shishir
- 12-16-2004 #2Linux User
- Join Date
- Jul 2004
- Location
- Poland
- Posts
- 368
Look at my answer at: http://www.linuxforums.org/forum/topic-29670.html
"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"
- 12-12-2008 #3Just Joined!
- Join Date
- Oct 2007
- Posts
- 6
Could it be gerp instead of grep?
- 12-12-2008 #4Linux User
- Join Date
- Jun 2007
- Posts
- 318
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:
Code:find ./ -name *.C | xargs grep "using namespace cem"



