Questions about zgrep, a front end to grep and that allows you to search inside gzipped files using regular expressions.
Questions tagged [zgrep]
11 questions
3
votes
1 answer
Fastest way to find lines starting with string in gzip file
I have a flat database based on 65536 files, each one containing one word by line starting with two hexadecimal characters.
They look like this:
afword
46word2
Feword3
...
I make tens of thousands of requests a day on this, so I'm looking for a…
James
- 71
- 4
2
votes
2 answers
How to run zgrep with multiple AND patterns?
I know how to do it with grep, but the command doesn't work with zgrep
grep -E 'Pattern1.*Patter2' fileName
I'm using zgrep to match patterns inside a .json.gz file.
Because the files are too big, I want to zgrep BOTH pattern1 AND pattern2, the…
PlayHardgoPro
- 121
- 1
- 3
1
vote
1 answer
Zgrep command is not working
I need to search "335664324" in the file A33256.xml.gz. I tried the following code.
sftp> zgrep -c "335664324" A33256.xml.gz
A33256.xml.gz
Invalid command.
I'm in the same directory as the file. How can I overcome this issue to display the output?
Shehan
- 11
- 1
1
vote
1 answer
zgrep a column and print the matching filename
I am trying to match pattern for a particular column in the thousands of gzipped files on a Linux machine, and based on the match I want to print the file name how to do that.
Below options are not working for me , any suggestions please.…
Forever Learner
- 729
- 1
- 10
- 17
1
vote
3 answers
Slow performance of zgrep in multiple files
I have a 9.8GB gzip file A.gz and other file i have is 79MB B.txt which has some text in each line.
I want to grep B's text in A.gz and write to a new file.
Initially, I used this command
zgrep -f B.txt A.gz > C.xml
But this command was hanged and…
happy
- 63
- 6
0
votes
3 answers
How to add column based in the second line match using SED or another command?
I have the following lines result from zcat command
1 - URL Template: https://www.test.com
2 - Response: <200 OK,{Server=[nginx], Date=[Wed, 11 May 2022 01:05:06 GMT], Content-Type=[text/html; charset=UTF-8], Transfer-Encoding=[chunked],…
user13737800
- 3
- 1
0
votes
0 answers
How to ignore errors in zgrep reader?
I want to search a directory's contents for a certain string on Ubuntu, and output all files that contain it.
Problem: if zgrep tries to read a damaged file, the process stops:
zgrep -n 'test' /var/log/tomcat/archive/*
Result:
gzip:…
membersound
- 431
- 1
- 5
- 17
0
votes
2 answers
How to extract few tabs from a xml file using zgrep or sed
I have a big size file like 5GB with .gz. Inside that file, we have few XML files that contains values that I want to search and extract just in case if those values are there.
For example I want to extract the tags that contains the name NOOSS and…
0
votes
0 answers
xargs with zgrep is giving the error
I have many gzipped files and I am trying to find some string pattern from the thousands of file but I am getting extra .gz while trying to zgrep it. Please refer the below, could you please advise. Thanks.
$ zcat…
Forever Learner
- 729
- 1
- 10
- 17
0
votes
3 answers
zgrep for multiple pipe symbols in a bunch of gz files
I have a lot of .gz files in a folder
/a/b/c1.gz
/a/b/c2.gz
/a/b/c3.gz
and so on.
Some of the files have a single pipe delimiter, some have two, three and four and so on, in such a way:
xyz|abc
xyz|abc|wty
xyz|abc|wty|asd
and so on.
How do I find…
Sicario007
- 3
- 1
0
votes
0 answers
Anyway to provide hint to zgrep to search part of file for faster search results
Production logs file are huge in size and are stored in compressed format.
I use the following to find specific log line
zgrep searchString LargeLogFiles*.gz
Typically this takes huge amount of time, when this runs on multiple files at once.
In…
mtk
- 26,802
- 35
- 91
- 130