Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-04-2008, 04:41 PM   #1
LQ Newbie
Registered: Aug 2008
Posts: 3

Rep: Reputation: 0
Does zgrep unzip a file then grep it?

I've got a server with limited space and I need to grep some zipped logs. If I have to zgrep a 50MB log will it need 50MB to store the unzipped log while it greps it?
Old 08-04-2008, 04:44 PM   #2
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
No, it is performed as a stream operation.

man zgrep:
     zgrep runs grep(1) on files or stdin, if no files argument is given,
     after decompressing them with zcat(1).

man zcat
     If invoked as gunzip then the -d option is enabled.  If invoked as zcat
     or gzcat then both the -c and -d options are enabled.
     -c, --stdout, --to-stdout
                       This option specifies that output will go to the stan-
                       dard output stream, leaving files intact.
Old 08-04-2008, 06:31 PM   #3
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,087

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
A 50 MEGAByte log ?

That's nothing nowadays - your "server" should easily be able to do this in RAM
Old 08-05-2008, 10:41 AM   #4
LQ Newbie
Registered: Aug 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for the responses.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to unzip .gz file on server??? how to [Paul Ferrie] Linux - Newbie 5 10-09-2006 01:33 AM
unzip file in debian davidhk Debian 3 04-17-2006 02:15 PM
how do i unzip a .gz file? xstealthrtx Linux - General 3 01-20-2005 12:26 PM
Can't unzip a file GhostOfYoda Linux - Newbie 4 07-27-2003 10:04 AM
unzip a tar.gz file klfreese Linux - Newbie 1 07-22-2003 11:35 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration