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

kaplan71 07-16-2008 12:56 PM

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 12:57 PM


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

forrestt 07-16-2008 12:59 PM

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 01:02 PM

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

Mr. C. 07-16-2008 03: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 12:51 AM.