[OT] - subthread - perl vs sed Re: [olug] Text search and Replace

Terry td3201 at yahoo.com
Tue Nov 25 18:59:00 UTC 2003


very true, in that case, spawn 1 perl thread and do
the loop inside of the perl process.

--- Brian Roberson <roberson at olug.org> wrote:
> While I am a huge fan of perl, I must say that it is
> overkill on things like
> this, say you had directory with 50,000 files...
> just think about spawning
> perl 50,000 time's vice sed plus the overhead that
> perl would add if the
> files where 10Mb+ in size. AFAIK - perl would load
> 10Mb into resident mem
> before even doing the substitution. sed uses the
> file control function fseek
> when you give it a filename instead of standard out.
> 
> 
> -- just an observation :)
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Terry" <td3201 at yahoo.com>
> To: <jnorton at jggt.com>; "Omaha Linux User Group"
> <olug at olug.org>
> Sent: Tuesday, November 25, 2003 10:52 AM
> Subject: Re: [olug] Text search and Replace
> 
> 
> > lots of ways to do it, here is a 1-liner for you:
> > perl -i.backup -pe 's/foo/bar/' filename
> >
> > you can write a loop around this easy enough in
> bash
> > to go through all files in a directory.
> >
> > This replaces all occurrences of foo with bar. 
> You
> > might need to tack on a g at the end of the regexp
> but
> > I don't think so.
> >
> > --- Jeff Norton <jnorton at jggt.com> wrote:
> > > I want to search a directory on my computer and
> > > replace certain text
> > > within documents with a new text.
> > >
> > > _______________________________________________
> > > OLUG mailing list
> > > OLUG at olug.org
> > > http://lists.olug.org/mailman/listinfo/olug
> >
> >
> > =====
> > Terry
> >
> > __________________________________
> > Do you Yahoo!?
> > Protect your identity with Yahoo! Mail
> AddressGuard
> > http://antispam.yahoo.com/whatsnewfree
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> >
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug


=====
Terry

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


More information about the OLUG mailing list