Re: edit_file and edit_file_lines

2011-06-07 Thread Uri Guttman
> "JG" == Jim Green writes: JG> I tried my @texts = read_file( 'zcat filename.gz|' ) but it doesn't JG> work, could someone help with this syntax? I would use PerlIO::gz for JG> large files but prefer a simple call to get the content I want for JG> smaller files. read_file uses syso

Re: edit_file and edit_file_lines

2011-06-07 Thread Jim Green
On May 15, 1:28 am, u...@stemsystems.com ("Uri Guttman") wrote: > hi all, > > As with other releases of File::Slurp I think this list should be told > about it since this module is so easy to use and makes your Perl much > simpler and also faster. > > uri > > Have you ever wanted to use perl -pi in

Re: edit_file and edit_file_lines

2011-06-02 Thread shawn wilson
On Jun 2, 2011 5:35 PM, "Uri Guttman" wrote: > > > "sw" == shawn wilson writes: > > sw> Nice addition to the module BTW. Haven't had the need for > sw> File::Slurp (used more specialized modules such as Text::CSV_XS or > sw> Web::Scraper) but this feature is definitely good. If not just >

Re: edit_file and edit_file_lines

2011-06-02 Thread Uri Guttman
> "sw" == shawn wilson writes: sw> That looks to be pretty much the same as: sw> zcat file ¦ script ¦ gzip -c - sw> (Untested) yes it is. and a perl one liner like perl -0777p le '$_ .= "text"' is all you need there. the issue is if text is large and/or from a file. sw> Nice additio

Re: edit_file and edit_file_lines

2011-06-02 Thread shawn wilson
On Jun 2, 2011 3:58 PM, "Uri Guttman" wrote: > > > "JG" == Jim Green writes: > > JG> Is there a preferred way to append a text file to the end of gzipped > JG> file? the api of File::Slurp append_file is nice, but doesn't work > JG> with gzip file... > > wow, that is an odd request. there

Re: edit_file and edit_file_lines

2011-06-02 Thread Uri Guttman
> "JSA" == John SJ Anderson writes: >> Is there a preferred way to append a text file to the end of gzipped >> file? the api of File::Slurp append_file is nice, but doesn't work >> with gzip file... JSA> The concatenation of two gzip'ed files is a valid gzip file, which JSA> when u

Re: edit_file and edit_file_lines

2011-06-02 Thread John SJ Anderson
> Is there a preferred way to append a text file to the end of gzipped > file? the api of File::Slurp append_file is nice, but doesn't work > with gzip file... The concatenation of two gzip'ed files is a valid gzip file, which when ungzip'd will produce a single file containing the contents of the

Re: edit_file and edit_file_lines

2011-06-02 Thread Uri Guttman
> "JG" == Jim Green writes: JG> Is there a preferred way to append a text file to the end of gzipped JG> file? the api of File::Slurp append_file is nice, but doesn't work JG> with gzip file... wow, that is an odd request. there is no direct way i think with append_file. maybe with edi

Re: edit_file and edit_file_lines

2011-06-02 Thread Jim Green
On May 15, 7:13 pm, u...@stemsystems.com ("Uri Guttman") wrote: > > "PJ" == Paul Johnson writes: > >   PJ> On Sun, May 15, 2011 at 01:31:47PM -0400, Jim Green wrote: >   >> this is very nice, don't need to call perl in perl anymore.. >   >> >   >> perl -pi -e '$_ = "" if /foo/' filename >   >>

Re: edit_file and edit_file_lines

2011-05-15 Thread Uri Guttman
> "PJ" == Paul Johnson writes: PJ> On Sun, May 15, 2011 at 01:31:47PM -0400, Jim Green wrote: >> this is very nice, don't need to call perl in perl anymore.. >> >> perl -pi -e '$_ = "" if /foo/' filename >> >> but what if the file is very large? slurping the file in to memory wi

Re: edit_file and edit_file_lines

2011-05-15 Thread Paul Johnson
On Sun, May 15, 2011 at 01:31:47PM -0400, Jim Green wrote: > this is very nice, don't need to call perl in perl anymore.. > > perl -pi -e '$_ = "" if /foo/' filename > > but what if the file is very large? slurping the file in to memory will > be ok? > > or is there any other alternatives you

Re: edit_file and edit_file_lines

2011-05-15 Thread Uri Guttman
> "JG" == Jim Green writes: JG> this is very nice, don't need to call perl in perl anymore.. JG> perl -pi -e '$_ = "" if /foo/' filename JG> but what if the file is very large? slurping the file in to memory will JG> be ok? in the slurp distro is an article i wrote for perl.com th

Re: edit_file and edit_file_lines

2011-05-15 Thread Jim Green
On 15 May 2011 01:28, Uri Guttman wrote: > > hi all, > > As with other releases of File::Slurp I think this list should be told > about it since this module is so easy to use and makes your Perl much > simpler and also faster. > > uri > > Have you ever wanted to use perl -pi inside perl? did you h

Re: edit_file and edit_file_lines

2011-05-14 Thread Uri Guttman
> "OR" == Octavian Rasnita writes: OR> Congratulations for the idea of adding this helpful feature to OR> File::Slurp. OR> It is also useful for adding a string at the beginning of the file OR> in an easy way, using something like: OR> edit_file { $_ = "first line\n" . $_ } 'file

Re: edit_file and edit_file_lines

2011-05-14 Thread Octavian Rasnita
From: "Uri Guttman" > > hi all, > > As with other releases of File::Slurp I think this list should be told > about it since this module is so easy to use and makes your Perl much > simpler and also faster. > > uri > > Have you ever wanted to use perl -pi inside perl? did you have the guts > to