GNU bug report logs - #42402
Enhancement request re zcat with empty files

Previous Next

Package: gzip;

Reported by: Peter Horn <peter.horn <at> bigpond.com>

Date: Fri, 17 Jul 2020 04:37:02 UTC

Severity: wishlist

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#42402: closed (Enhancement request re zcat with empty files)
Date: Thu, 07 Apr 2022 00:09:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 6 Apr 2022 17:08:17 -0700
with message-id <a05494ab-6d76-916b-cfcd-961f968c529e <at> cs.ucla.edu>
and subject line Re: Enhancement request re zcat with empty files
has caused the debbugs.gnu.org bug report #42402,
regarding Enhancement request re zcat with empty files
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
42402: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=42402
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Peter Horn <peter.horn <at> bigpond.com>
To: bug-gzip <at> gnu.org
Subject: Enhancement request re zcat with empty files
Date: Fri, 17 Jul 2020 13:42:04 +1000
Hello list,

This is my first post here, so apologies in advance for whatever I get 
wrong.

I am asking for an enhancement to zcat, that it should silently ignore 
empty files, either always, or (if that conflicts with POSIX or some 
other standard), by a command line option.

My use case is as follows:
I maintain a server, and have occasion to scan log files for specific items.
As is typical in a logrotate environment, the files are something like

xyz.log              current
xyz.log.1           previous
xyz.log.2.gz
xyz.log.3.gz      etc etc

Most of the time I can search for something by

zgrep 'target' xyz*

But, wanting to further process a number of entries, I tried the obvious

zcat xyz* | awk ...

which results in

gzip: xyz.log.1: unexpected end of file

I note that it correctly handles archives with no content (just the 20 
byte header)

Regards,
Peter


[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Peter Horn <peter.horn <at> bigpond.com>
Cc: 42402-done <at> debbugs.gnu.org
Subject: Re: Enhancement request re zcat with empty files
Date: Wed, 6 Apr 2022 17:08:17 -0700
> I am asking for an enhancement to zcat, that it should silently ignore 
> empty files, either always, or (if that conflicts with POSIX or some 
> other standard), by a command line option.

zcat -f does what you're asking for. For example:

$ touch empty
$ echo something | gzip >abc.gz
$ zcat -f *
something

Since the -f option satisfies your request I'll close the bug report.


This bug report was last modified 3 years and 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.