Do not show line haveing particular keyword by grep command
Generally we use grep command to get the lines which has particular line in a file.There is one more option in grep by which you will not get the lines in output which has some specific keyword or keywords.
To do not get lines in output with specific keywords by using grep command,use the given below syntax
In given below replace the keyword with your desired word which you do not want to show in output
(1) For single keyword in a file
grep -v keyword filename
(2) For multiple keyword in a file
grep -v 'keyword1|keyword2|keyword3|keywordN' filename
(3) For recursively search all files inside folders and its subfolders use-r option in grep command.
for single keyword
grep -r -v 'keyword' filename /absoulte-path-of-directory/*
for multiple keyword
grep -r -v 'keyword1|keyword2|keyword3|keywordN' absoulte-path-of-directory/*
Note: For insensitive case use -i option with all above examples.
grep -i -v wordpress filename
Below is the reference of grep command
Rick Nelson says
Exactly what i needed
Thank you so much