search files without a specific text

Hi all,

I need UNIX command that would give me all files without the string "4R" anywhere in the file. I have about a hundred files in my directory, and I need to list all files wihtout the string "4R" anywhere. Can anyone help me please? Thank you.l

find /path -type f -exec grep -L "4R" {} \;

Read the manual for find and grep.

Thanks for the reply danmero, but this code does the opposite. it returns all files with the text "4R". I need to return all files WITHOUT "4R". I also tried negating it using ! character as suggested in other thread here, but sill did not work. I hope you can help. thanks again.

That's I suggest you to read the manual for find and grep for your operating system :wink:
Anyway the solution work for me on FreeBSD.

thanks for the reply. I was able to solve it now using the code below:

find ./myDirectory -type f ! -exec grep -lv '4R' {} \;

thsnks so much for the reply, is still helps. :slight_smile: