Questions tagged [zgrep]

zgrep is a linux command that searches gzipped files for a regular expression. Use this tag for questions related to the zgrep command.

zgrep is a linux command for performing grep on gzip compressed files. In other words you can use zgrep to search compressed files for a regular expression.

32 questions
0
votes
1 answer

How to read and get the complete text line from compressed file using golang

There is a compressed text file(.gz) has some set of warning, error and information details. Sample content. Oct 25 06:58:51 : For info, please visit https://www.det.org Oct 25 06:58:51 : Copyright 2004-2018 Internet Systems Consortium. Oct 25…
0
votes
1 answer

using Zgrep and awk to parse a .tgz file and print first row

I would like to use Zgrep and Awk to print specific lines. I use the below script. However, I am not able to print the specific line requirement. zcat SYS.20210519.tgz | awk '/11055/ && /2.5.5.5/' It would be nice if someone could help. Thanks. File…
0
votes
1 answer

How could I change this egrep script to a zgrep script and still have it work?

I'm trying to look for phone numbers in any of the following formats: +1.570.555.1212, 570.555.1212, (570)555-1212, and 570-555-1212. We also need to look in compressed folders using zgrep, however I would have my code come back "No matches found".…
Joey
  • 23
  • 3
0
votes
0 answers

Faster zgrep for Python 3.8.2

I have a large directory of *.gz files that I need to find all files that contain the required ID on a given date. My code works as expected, but it is very slow. I was curious if anybody knew of a faster was to process these files with python.…
Will_Roberts
  • 21
  • 1
  • 6
0
votes
0 answers

Reading auth.log files from a php file and displaying it on web page

I have an Ubuntu 18.04 server, and have been trying to create a php file that searches through auth.log for certain attributes and then displays them onscreen. The php file has permission 644 and root:root as the owner:group. The auth.log file is…
0
votes
3 answers

Using bash to query a large tab delimited file

I have a list of names and IDs (50 entries) cat input.txt name ID Mike 2000 Mike 20003 Mike 20002 And there is a huge zipped file (13GB) zcat clients.gz name ID comment Mike 2000 foo Mike 20002 bar Josh 2000 …
Shahin
  • 1,196
  • 1
  • 8
  • 15
0
votes
1 answer

Why won't zgrep show the actual matches?

Context Let's say I have two files a.txt and b.txt with some content... $ tail *.txt ==> a.txt <== ABC CDE 123 C ==> b.txt <== C 321 EDC CBA Let's also imagine that the files have now been put in a gzipped tarball... $ tar -czf tarball.tgz *.txt $…
snooze92
  • 4,178
  • 2
  • 29
  • 38
0
votes
2 answers

Big grep from txt list in .gz file logs

this is my problem (for me actually a big problem). I have a txt file with 1.130.395 lines as below an example: 10812 10954 10963 11070 11099 10963 11070 11099 betti.bt betti12 betti1419432307 19442407 19451970 19461949 i have like 2000 .gz log…
Emanuele
  • 73
  • 1
  • 1
  • 7
0
votes
2 answers

Unique count of a value in a zipped file based on other constraints on surrounding lines

I have a log file. Has data like this: Operation=ABC, CustomerId=12, .. .. .. Counters=qwe=1,wer=2,mbn=4,Hello=0,…
user2116243
  • 303
  • 2
  • 10
0
votes
1 answer

Python subprocess.check_output conver to windows

I wrote some code that works fine on a Linux machine but does not run on windows. import subprocess import pandas as pd try: from StringIO import StringIO except ImportError: from io import StringIO def zgrep_data(f, string='',…
0
votes
0 answers

Find + zgrep covers only last 3 days

I'm having a problem with find and zgrep commands. Here's the full command I try to use: find ~/xyz/server*/p* -mtime -14 -type f | xargs zgrep -h "qq/ww/ee/calendar\|qq/ww/ee/flights" What I'm trying to achieve is zgrep (as the files are in .gz) a…
boberczus
  • 3
  • 4
0
votes
1 answer

zgrep on multiple input variables issue

I have an issue using zgrep. I want to look for a XML file based on an ID and a certain Date given by the user. Each XML file contains an ID and a date in it. The program should acknowledge that these files may have the same ID but a different Date.…
Jafet Soto
  • 41
  • 6
0
votes
0 answers

grep a tar.gz file where tar contains other gz files

I have a tar gz file. Inside the file are other directories and gz files and I am trying to recursively grep for a string. I have tried zgrep but the string I am searching for is not outputted even though I know it is there. What would be the…
0
votes
2 answers

how to use grep to parse out columns in csv

I have a log with millions of lines that like this 1482364800 bunch of stuff 172.169.49.138 252377 + many other things 1482364808 bunch of stuff 128.169.49.111 131177 + many other things 1482364810 bunch of stuff 2001:db8:0:0:0:0:2:1 124322 + many…
chowpay
  • 1,515
  • 6
  • 22
  • 44
0
votes
1 answer

Percentage or number of files processed by grep command

If I am searching/checking for an KeyWord/String using GREP command from 1000 files for example; then is there any option/way to see/display the percentage or number of files processed by the GREP command...?. Just I would like to know how long…
Krishna
  • 609
  • 1
  • 6
  • 17