bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GZIP/Perl


From: Bob Proulx
Subject: Re: GZIP/Perl
Date: Thu, 4 Mar 2004 16:13:37 -0700
User-agent: Mutt/1.3.28i

Enamandram, Anand K wrote:
> I have a question on gzip that I think you might be able to address:

Well, it is not really gzip but really a perl question.

> I have a perl utility that outputs lines to a text file. Problem is, the
> file size goes over 2GB and Linux cant handle it .

My machine with a Linux kernel handles large files fine.  ("large
files" denote files larger than 2GB.)  Consider upgrading to a 2.4 or
later series Linux kernel.

> I am thinking of "gzip"ping the lines and DIRECTLY outputting the gzip
> file rather than output the text and then gzip it manually, once the
> utility has finished.
>  
> Any ideas ? Let me know when you get a chance. An example line or two of
> code will help greatly.

In perl if you open a file with a | it will really popen(3) it instead
and you can write to it.  This is off the top of my head and may have
errors but you should get the idea.

  open(FILE,"| gzip > /tmp/foo.gz") or die "Failed to open gzip to file\n";
  FILE->print "hello\n";
  close(file) or die "Error: Failed to write to gzip to file\n";

Make sure you check close for a proper return code since that is where
all errors will be reported.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]