[lug] using sed.

rm at mamma.varadinet.de rm at mamma.varadinet.de
Mon Nov 6 11:28:17 MST 2000


On Mon, Nov 06, 2000 at 11:11:18AM -0700, Tkil wrote:
> >>>>> "Chris" == Chris Riddoch <socket at peakpeak.com> writes:
> 
> Chris> English translation, for the German-impaired:
> 
> heh.  i got most of the german, but it's just as easy to reply to
> yours.  :)
> 
> Chris> What that script doesn't do is change the original file..  How
> Chris> can that be done again?
> 
> well, as Ralf points out, perl's "-i" switch handles this easily.  the
> example used is a bit broken, however, since anything immediately
> after the "-i" is used as the suffix for the original verrsion of the
> file.  thus, i tend to use something like this:
> 
>    perl -i~ -pe 's/foo/bar/g' file1 file2 file3 ...

Sorry, i had a lot of latency on the line and somehow a 
space crept in. The line should read:
  
  perl -ip.bu -e 's/(blank)/$1.extension/og;' dir/*
          ^  
          |
	  *---- no space here!


Thanks for the correction!


 Ralf





More information about the LUG mailing list