Originally posted by Unregistered
(i grep everything but the files with a specific ending(ie) .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:
Code:
find /home/jdeckard ! -name "*.txt" -exec grep "Hello World" {} \;
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.
This isn't really a C question, so you may be better served by asking around on the *nix newsgroups.
Cheers,