Questions tagged [zcat]

Unix/Linux command that expands a compressed file to standard output.

80 questions
106
votes
6 answers

How to get few lines from a .gz compressed file without uncompressing

How to get the first few lines from a gziped file ? I tried zcat, but its throwing an error zcat CONN.20111109.0057.gz|head CONN.20111109.0057.gz.Z: A file or directory in the path name does not exist.
Govind Kailas
  • 2,645
  • 5
  • 22
  • 24
50
votes
5 answers

zcat won't unzip files properly

I need to unzip a compressed file on the fly in my program. It works when I try it on my own linux computer, but for some reason the school computers fail whenever I tell them to do it. To unzip I'm using the following command: zcat…
Zain Rizvi
  • 23,586
  • 22
  • 91
  • 133
14
votes
2 answers

zcat files in and not in gzip format

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...…
Josh
  • 143
  • 1
  • 4
13
votes
4 answers

find results piped to zcat and then to head

I'm trying to search for a certain string in a lot of gziped csv files, the string is located at the first row and my thought was to get the first row of each file by combining find, zcat and head. But I can't get them to work together. $find .…
furedde
  • 133
  • 1
  • 1
  • 5
10
votes
4 answers

Alternate to PHP exec() function

Currently I am using: exec("zcat $filename", $output) To uncompress a .Z type file but unfortunately my hosting company has now disabled this function. Is there a workaround? $pathtofile = "filename.lis.Z"; exec("zcat $pathtofile", $output);
Saad Bashir
  • 4,341
  • 8
  • 30
  • 60
8
votes
3 answers

How to minimize the time for Unzipping & zipping the files in Unix?

I have to unzip and then (after processing) again zip(archive) the source files. File sizes are huge typically around 200-250 GB (unzipped, .dat format)(total 96 files). The process of unzipping takes around 2 hours and again the zipping process…
user2446876
  • 103
  • 1
  • 1
  • 4
7
votes
2 answers

Python equivalent of piping zcat result to filehandle in Perl

I have a huge pipeline written in Python that uses very large .gz files (~14GB compressed), but need a better way to send certain lines to an external software (formatdb from blast-legacy/2.2.26). I have a Perl script someone wrote for me a long…
Julian Egger
  • 71
  • 1
  • 3
5
votes
1 answer

Can i concatenate two already gzipped files (using gzip) and then gunzip them?

Can i concatenate two already gzipped files (using gzip) and then gunzip them? As of today, I download the gzipped files from remote servers, gunzip them individually and then cat them to merge. Looking to make things faster here by merging the…
Pradeep
  • 109
  • 5
4
votes
4 answers

zcat pipe to grep

ls -ltr|grep 'Mar 4'| awk '{print $9 }'|zcat -fq |grep 12345 I want to find all files modified on a certain date and then zcat them and search the fiels for a number string. the above doesn't work because it searches the file name for the string…
matt123
4
votes
3 answers

Why doesn't my Perl pipe to zcat die if the file is not there?

If my gz file does not exist, why doesn't it DIE? $ cat test.pl open(FILE, "zcat dummy.gz |") or die "DIE"; $ ./test.pl zcat: dummy.gz: No such file or directory If I read a file normally, it works as expected: $ cat test2.pl …
dogbane
  • 266,786
  • 75
  • 396
  • 414
3
votes
1 answer

Cron job for generate Go Access report not working

In my root crontab (sudo crontab -e) I have this job to generate Go Access log reports: * * * * * goaccess /var/log/nginx/access.log -o /home/me/some/path/report.html It works just fine. I also have this job to generate a report that spans multiple…
DukeSilver
  • 458
  • 1
  • 6
  • 22
3
votes
1 answer

How to use zgrep and regular expression?

I'm trying to do some research in a .gz file so I found out I should use zcat / zgrep now after a bit of research I can't figure out how to use a regex with zgrep I tried to do it like this zgrep '[\s\S]{10,}' a.gz but nothing comes out even if…
J.erome
  • 688
  • 7
  • 26
3
votes
2 answers

how to use subprocess with multiple multiple stdin from zcat

I would like to convert the following shell command into python code using subprocess. In particular, how to convert the multiple <(zcat ...) as stdin? Ideally, the code should use subprocess.call, but subprocess.Popen is fine,…
zyxue
  • 7,904
  • 5
  • 48
  • 74
3
votes
2 answers

zcat a file, output its contents to another file based on original filename

I'm looking to create a bash/perl script in Linux that will restore .gz files based on filename: _path_to_file.txt.gz _path_to_another_file.conf.gz Where the underscores form the directory structure.. so the two above would…
user2726407
  • 33
  • 1
  • 4
3
votes
2 answers

Extract value from .gz log files in unix

I'm trying to extract a specific value (e.g userAgent in this case) from bunch of .gz log files which are essentially compressed log files. The format of each log statement in these log files looks like this : 2013-06-20;02:00:02.503…
codehammer
  • 876
  • 2
  • 10
  • 27
1
2 3 4 5 6