I need a command to search files in a directory which does not match with pattern .. Plz send me this
Ex : Test is directory and has some 10 files with different name all are with *.dat extension , need to search files which doesnot contain word "Dummy file".
That will just display all lines in all files that do not contain "Dummy file".
Try this instead:
# list files that *do* contain "Dummy file" and save in a file
grep -l "Dummy file" * > /tmp/matches
# use that file to exclude them from the list of files
ls | grep -xvf /tmp/matches
Oh ... I just came across this using Google looking for something. Thought I would post the answer. Maybe, someone else would benefit. Anyways, I dont see why the answer is wrong.