Re: searching big gzipped files



On 2007-03-29, asdf wrote:
I have a number of gzipped files that are created on the fly by
another process piping output to gzip. These files are too big to
save to disk in regular manner.

Problem is I would like to grep for data in the unzipped form of the
file.

I normally do a zcat foo.gz | grep "something"

This works but is pretty slow. I was wondering if there was a way of
taking a ".gz" file and building sometype of index so its uncompressed
form could be searched quickly, and where there is no need to unzip
the file...

zgrep "something" foo.gz

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
.



Relevant Pages

  • Re: searching big gzipped files
    ... save to disk in regular manner. ... Problem is I would like to grep for data in the unzipped form of the ...
    (comp.os.linux.misc)
  • Re: disk full error
    ... whether it is possible to capture "disk full error" from shell scripts ... since in above command grep output is redirected to file2, ... The exit status varies between utilities. ... echo no match;; ...
    (comp.unix.shell)
  • 8.0 dmesg output is mangled
    ... dmesg | grep siis ... The Samsung disk is connected to a JMB363 controller, not the SiI 3132. ...
    (freebsd-questions)
  • Re: [opensuse] How do I turn off the modem
    ... you could do a grep on the entire disk ... to find the string. ... will complain that some thing is missing. ...
    (SuSE)
  • Re: [PATCH] thinkpad_acpi.c: Remove #define TPACPI_s for printks
    ... To make grep a bit easier. ... Unfolding the printk messages to a single line _is_ useful for grep, though, ... "One disk to rule them all, ...
    (Linux-Kernel)