Tuesday, April 11, 2023

Search files in Unix which doesn't contain specific Text

Simple Grep command to search all files in a directory 

grep -RiL "Text to search" <Directory to be searched>



Grep command with Find together, searching only those file names which doesn't have a specific text.

find . -name *.automationTask | xargs grep -RiL "sendNullMessage" ;

find . -iname "*.txt" -exec grep -Li "mystring" {} \+