Unix/Linux command that expands a compressed file to standard output.
Questions tagged [zcat]
80 questions
1
vote
1 answer
BASH how to filenames from a file and zcat them
Suppose I have a directory with contents like this:
$ ls
file1.csv.gz
file2.csv.gz
file3.csv.gz
file4.csv.gz
listOfFiles.txt
listOfFiles.txt contains a list of the files which I want to zcat and pipe to awk to process their contents. For instance,…

Rusty Lemur
- 1,697
- 1
- 21
- 54
1
vote
2 answers
syntax error near unexpected token `(' when using multiple input streams from zcat in Python subprocess
I ran this in Python 3.5:
import subprocess
subprocess.run(
'some_command --option <(zcat some_file_1.gz) <(zcat some_file_2.gz)',
shell=True
)
Got this error:
/bin/sh: -c: line 0: syntax error near unexpected token `('
Any help will be…
1
vote
1 answer
zcat failing in ansible-playbook
I am trying to import the schema it is failing , please suggest me to solve this error
- name: Import the initial schema
command: zcat /usr/share/doc/zabbix-server-mysql-3.2.5/create.sql.gz | mysql -uzabbix -p zabbix
TASK: [zabbix-server | Import…

user6826691
- 1,813
- 9
- 37
- 74
1
vote
1 answer
Zcat with lines' indexes
How can I see the indexes of lines with zcat?
I tried to find a flag of zcat, but didn't find one that show lines' numbers.
Example:
My file contains these lines:
Hello everybody!
aaa bbb
aaa Hello
What I want to get from this command:
zcat file |…

pnina
- 119
- 1
- 2
- 10
1
vote
2 answers
Zcat + awk with absolute path
In my "test.tar.gz" there is a text file : "test.txt" with :
col1 {tab} col2 {tab} col3
-
The problem is, when I run it :
zcat ./folder1/test.tar.gz | awk -F '\t' '{print $1, $3}'
It returns :
test.txt
So if I add :
zcat…

robinwood13
- 179
- 1
- 1
- 8
1
vote
2 answers
Combining compressed Gzipped Text Files using Java
my question might not be entirely related to Java but I'm currently seeking a method to combine several compressed (gzipped) textfiles without the requirement to recompress them manually. Lets say I have 4 files, all text that is compressed using…

w3b1x
- 123
- 1
- 6
1
vote
0 answers
Reconstructing an archived SQLite3 database file
I'm using the method described under the heading Converting An Entire Database To An ASCII Text File on this page to archive a sqlite3 database file.
Archiving the database file works fine:
$ echo '.dump' | sqlite3 store.db | gzip -c…

Ross
- 4,460
- 2
- 32
- 59
1
vote
3 answers
Extract and count value from standard .gz log files on an hourly basis
I'm trying to count the number of occurrences of a particular string from a bunch of .gz logfiles on an hourly basis. Each logfile statement starts with the following time format:
2013-11-21;09:07:23.433.
For example, to be more clear, find the…

codehammer
- 876
- 2
- 10
- 27
1
vote
3 answers
Http get ungzip response in bash
I need to manually ungzip response of the following page: http://muaban.net/ho-chi-minh.html
I'm doing
echo -e "GET /ho-chi-minh.html HTTP/1.1\r\nHost: muaban.net\r\nAccept-Encoding: gzip\r\n" | nc muaban.net 80 > response.txt
until response…

spacevillain
- 1,336
- 1
- 14
- 25
0
votes
2 answers
How to use zcat with regex in perl?
I have compressed .gz files that I want to open by using:
./open.pl file.gz
Basically my goal is to only print out certain lines in the zip file that match my regex...The files are big so I just want to output to stdout for now...How would I do…

user1224478
- 345
- 2
- 5
- 15
0
votes
2 answers
llseek return ESPIPE when calling zcat all.tgz | ./cycletee
I modified GNU tee to cycletee Source Code (You can download the binary from https://github.com/vls/cycletee/tree/master/bin)
What it does can be explained by the following example:
seq 10 | cycletee 1.txt 2.txt 3.txt
cat 1.txt // prints 1, 4, 7,…

ukessi
- 1,381
- 1
- 10
- 15
0
votes
0 answers
Process substitution tcpdump script error
If I write the following command in a terminal it work perfectly
tcpdump -w 1.pcap -nnr <( zcat /work/save1.pcap.gz ) '((tcp[13]==2 or tcp[13]==4) and (dst port 80)) or (udp and dst port 5060)'
If I put it in a script I get an error like…

papafe
- 2,959
- 4
- 41
- 72
0
votes
2 answers
Segmentation fault 11, zcat pipe into postgresql 9.0.5 (Lion)
I have a bash script as such:
GITUSER="mygituser"
DBUSER="mysitedbuser"
DB="mysitedb"
SITE="mysite.com"
REPO="/var/git/myproject.git" # on the server
dropdb -U $DBUSER $DB &&
echo "remote db dump (gzip)" &&
F=`ssh $GITUSER@$SITE…

Calvin Cheng
- 35,640
- 39
- 116
- 167
0
votes
1 answer
Concatenate a csv file in archive
I stumble with a problem.
I need to read a .csv table in an archive without extracting it.
When I try to do that, I face metadata bits in the beginning of the file.
➜ dir ls
people-10000.tar.gz
➜ dir zcat people-10000.tar.gz | head…
0
votes
1 answer
Looking for a specyfic message in zipped pcap files
I have around 7200 compressed .pcap files. Each is compressed into a separate .gz file. I need to look for a specific string in packet data details. I would like to write a command to do that. At the moment all I have is:
zcat 20230212*.pcap.gz |…

cinosz
- 3
- 2