Joost Diepenmaat
5/4/2005 2:28:00 PM
On Wed, May 04, 2005 at 11:20:21PM +0900, Ralf Müller wrote:
> On Wed, 4 May 2005 23:06:21 +0900
> James Edward Gray II <james@grayproductions.net> wrote:
>
> > On May 4, 2005, at 8:59 AM, Ralf Müller wrote:
> >
> > > On Wed, 4 May 2005 22:30:07 +0900
> > > "Robert Klemme" <bob.news@gmx.net> wrote:
> > >
> > >
> > >> But it's simpler - as simple as
> > >>
> > >> ruby -pi.bak -e 'gsub /\d+/, "###"' your_file
> > >>
> > >
> > > But what about using \1 and \n in the second argument of gsub. Doesn't
> > > require \1 single-quotes
> > > and \n double quotes?
> >
> > No. If you want to put \1 in double quotes, just add a backslash.
> > "\\1\n" works fine.
> >
> > Hope that helps.
> >
>
> Great.
> At last i can get rid of these perl one-liners.
You mean you prefer
ruby -pi.bak -e 'gsub /\d+/, "###"' your_file
over
perl -pi.bak -e 'gsub /\d+/, "###"' your_file
?
Yeah, I can clearly see the advantage :-)