Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zcat files in and not in gzip format

Tags:

linux

pipe

zcat

I have all my Apache access log files as access.log, access.log.1 access.log.1.gz etc... What I want is to zcat all files in and not in gzip format and pipe them into an X program.

I know I can do: zcat /var/log/apache2/access.log.*.gz | someapp... but that will just work for *.gz and not the first two logs.

Any ideas will be appreciate it

like image 494
Josh Avatar asked Feb 06 '10 04:02

Josh


People also ask

Is not in gzip format?

While working with the archived files in Linux, we might face the error “gzip:stdin: not in gzip format”. This error occurs because the file has only been archived, not compressed. That means the file is not compressed using gzip utility rather renamed.

What is zcat file?

Description. The zcat command allows the user to expand and view a compressed file without uncompressing that file. The zcat command does not rename the expanded file or remove the . Z extension. The zcat command writes the expanded output to standard output.

What is difference between gzip and gunzip?

On Unix-like operating systems, the gzip command creates, lists, modifies, and extracts data from GZIP archives. The gunzip command extracts data from GZIP archives.


1 Answers

use zcat -f, it will copy uncompressed files as is

like image 107
ergosys Avatar answered Sep 19 '22 20:09

ergosys