Questions tagged [zgrep]

Questions about zgrep, a front end to grep and that allows you to search inside gzipped files using regular expressions.

Filter by
Sorted by
Tagged with
0 votes
3 answers
64 views

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; ...
user avatar
0 votes
0 answers
20 views

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/...
user avatar
0 votes
2 answers
92 views

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 ...
user avatar
0 votes
1 answer
153 views

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 ...
user avatar
  • 1
0 votes
2 answers
61 views

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 ...
user avatar
3 votes
1 answer
269 views

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 ...
user avatar
  • 71
1 vote
1 answer
182 views

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 ...
user avatar
1 vote
0 answers
92 views

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. ...
user avatar
1 vote
3 answers
882 views

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....
user avatar
  • 63
0 votes
3 answers
412 views

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 ...
user avatar
0 votes
0 answers
68 views

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 ...
user avatar
  • 24.1k