LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-04-2008, 05:41 PM   #1
bonz78
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, 05:44 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

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

Code:
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, 07:31 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

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

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

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


Reply


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 02:33 AM
unzip file in debian davidhk Debian 3 04-17-2006 03:15 PM
how do i unzip a .gz file? xstealthrtx Linux - General 3 01-20-2005 01:26 PM
Can't unzip a file GhostOfYoda Linux - Newbie 4 07-27-2003 11:04 AM
unzip a tar.gz file klfreese Linux - Newbie 1 07-23-2003 12:35 AM


All times are GMT -5. The time now is 01:03 AM.

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