-   Linux - Software (
-   -   Command syntax question for grep (

kaplan71 07-16-2008 11:56 AM

Command syntax question for grep
Hi there --

I am running a script that includes the following grep statement:


grep -v ' OK' clamscan_output.txt > /tmp/clamscan_outputsummary.txt
I would like to modify the above statement so that in addition to removing any lines that include 'OK', lines that include 'Empty file' are also removed from the output.

How can this be done? Thanks.

colucix 07-16-2008 11:57 AM


grep -v ' OK' clamscan_output.txt | grep -v 'Empty file' > /tmp/clamscan_outputsummary.txt

forrestt 07-16-2008 11:59 AM

You can do it by specifying your expressions with the -e option like:


grep -v -e ' OK' -e 'Empty file' clamscan_output.txt > /tmp/clamscan_outputsummary.txt


kaplan71 07-16-2008 12:02 PM

I tried the syntax you suggested, and it worked. Thanks for the help.

Mr. C. 07-16-2008 02:13 PM

or use egrep and the or | operator.

egrep -v ' OK|Empty file' clamscan_output.txt

All times are GMT -5. The time now is 08:09 PM.