Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grep -v option

0 views
Skip to first unread message

Mark Lockett

unread,
Nov 4, 2004, 5:05:15 PM11/4/04
to
I am trying to parse lines out of a txt file. Instead of running the
command three times, how can I add all the parameters together for the
-v option. Thanks for the help.

Jon Ericson

unread,
Nov 4, 2004, 5:44:56 PM11/4/04
to
mloc...@alfains.com (Mark Lockett) writes:

This isn't strictly a Perl question. In shell:

$ grep -v x filename | grep -v y | grep -v z

With perl:

$ perl -ne 'print unless /x|y|z/' filename

It sound's like you have some problem with the shell solution, but I
don't know what it might be.

Jon

Michele Dondi

unread,
Nov 4, 2004, 6:17:50 PM11/4/04
to
On 4 Nov 2004 14:05:15 -0800, mloc...@alfains.com (Mark Lockett)
wrote:

>I am trying to parse lines out of a txt file. Instead of running the
>command three times, how can I add all the parameters together for the
>-v option. Thanks for the help.

Are you asking about grep or perl? Hint: '|' *may* be what you want in
both cases...


Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,

Tad McClellan

unread,
Nov 4, 2004, 8:41:30 PM11/4/04
to
Mark Lockett <mloc...@alfains.com> wrote:

> Subject: Grep -v option


grep(1) is not Perl.

Did you have a Perl question?


--
Tad McClellan SGML consulting
ta...@augustmail.com Perl programming
Fort Worth, Texas

Jürgen Exner

unread,
Nov 4, 2004, 9:49:26 PM11/4/04
to
Mark Lockett wrote:
> I am trying to parse lines out of a txt file. Instead of running the
> command three times, how can I add all the parameters together for the
> -v option.

Which -v option are you talking about? "perldoc -f grep" doesn't mention it.

jue


David Combs

unread,
Nov 24, 2004, 5:12:12 PM11/24/04
to
In article <rcgwtx1...@Jon-Ericson.sdsio.prv>,

Jon Ericson <Jon.E...@jpl.nasa.gov> wrote:
>mloc...@alfains.com (Mark Lockett) writes:
>
>> I am trying to parse lines out of a txt file. Instead of running the
>> command three times, how can I add all the parameters together for the
>> -v option. Thanks for the help.
>
>This isn't strictly a Perl question. In shell:
>
> $ grep -v x filename | grep -v y | grep -v z

egrep allows alternation, no?

0 new messages