Saturday, October 11, 2014

Find files which don't have a keyword

In our normal day to day activities, we often needs to search for files looking for some keyword. But when you need to search for files which don't have a specific keyword in linux. Below I gave the answer for it. This search for java files which don't have the keyword WARRANTIES. -L flag in grep gives this functionality.

grep -rL "WARRANTIES" --include=*.java  *

No comments:

Post a Comment