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

Re: Scripting help please



On Wed, May 04, 2005 at 09:52:53PM -0700, Will Yardley wrote:
> On Wed, May 04, 2005 at 09:59:08AM -0500, Ed Wilts wrote:
> > 
> > replace ', ' '* ' -- $filename
> > 
> > replace can process multiple files at once and does the changes in
> > place.
> 
> How is this any better than "sed -i", e.g.,
> sed -i 's/, /* /g' filename

replace starts to pay for itself when you need to process multiple files
or if you want to swap character strings.  For example,  
replace a b b a -- *htm
will swap the strings a and b around in all the files.

For simplicity, I think replace wins.  For overall power, sed wins.
That's one of the nice things about Linux - we have a wide variety of
tools at our disposal that may be capable of doing the job.

-- 
Ed Wilts, RHCE
Mounds View, MN, USA
mailto:ewilts ewilts org
Member #1, Red Hat Community Ambassador Program


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