When handling log files, some end up as gzipped files thanks to logrotate
and others not. So when you try something like this:
$ zcat *
you end up with a command line like zcat xyz.log xyz.log.1 xyz.log.2.gz xyz.log.3.gz
and then with:
gzip: xyz.log: not in gzip format
Is there a tool that will take the magic bytes, similar to how file
works, and use zcat
or cat
depending on the outcome so that I can pipe the output to grep
for example?
NB: I know I can script it, but I am asking whether there is a tool out there already.