Deepu <> wrote:
> I am trying to count the number of errors in a file:
> I use:
>
> $ctError = `grep -ci error filename`;
> Now i am trying to count error which doesnot contain Virtual,
$ctError = grep !/virtual/i, `grep -ci error filename`;
or, probably less confusing:
$ctError = grep !/virtual/i, qx/grep -ci error filename/;
Or don't use grep(1) at all, and do it all with (tricky) Perl:
perl -lne '$cnt++ if /error/i and not /virtual/i }{ print $cnt' filename
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas