how can i grep all the files BUT a string without .txt within it.
(i grep everything but the files with a specific ending(ie) .txt)
tnx
This is a discussion on grep within the C Programming forums, part of the General Programming Boards category; how can i grep all the files BUT a string without .txt within it. (i grep everything but the files ...
how can i grep all the files BUT a string without .txt within it.
(i grep everything but the files with a specific ending(ie) .txt)
tnx
You might want to try the following version of grep, it should find all instances except what is specified.
egrep -v *.txt
Hopefully I haven't misunderstood your question. Here is how to grep for the phrase Hello World from every file in your (or in this case, my) home directory except for the files that end in .txt:Originally posted by Unregistered
(i grep everything but the files with a specific ending(ie) .txt
This tells find to start looking for any file in /home/jdeckard that does not (!) end in .txt. Everytime a file is found that does not end in .txt, grep is executed. Grep looks for "Hello World" in the file {}. Where find is concerned, {} represents the current filename. The escaped semi-colon on the end is important.Code:find /home/jdeckard ! -name "*.txt" -exec grep "Hello World" {} \;
This isn't really a C question, so you may be better served by asking around on the *nix newsgroups.
Cheers,
Jason Deckard
thanks jason