[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zgrep -<NUM> doesn't work if <NUM> is two digits or greater

From: Eric Blake
Subject: Re: zgrep -<NUM> doesn't work if <NUM> is two digits or greater
Date: Mon, 06 Aug 2012 16:20:02 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 08/06/2012 12:39 PM, Thomas Bushnell, BSG wrote:
> Create a gzipped file:
>    $ for i in $(seq 1 100); do echo $i; done > file.txt

Save some effort, by using:

seq 100 > file.txt

> works.  But:
>    $ zgrep -10 17 file.txt.gz
>    gzip: 17.gz: No such file or directory

Yep, the zgrep option parser is busted on 2-digit numbers; it tries to
separate things into '-1 0' rather than rewriting it to '-C 10' or even
passing it through unchanged.

But you must remember that gzip _already_ understands '-1' through '-9'
as independent options.  So which should win?  Should zgrep assume that
you are asking for option -1 followed by option -0 for use by gzip, or
that you are asking for option -10 understood by grep?  Or do the
numeric options of gzip only apply to compression, but zgrep implies
decompression, therefore we should be assuming grep syntax instead of gzip?

> Please include me in the CC on any replies.

That's list policy, anyway.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]