Email address obfuscation in effect -- please
click here to turn it off.
[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
On Fri, 5 Apr 2002, Scott Hussey wrote:
> On Thu, Apr 04, 2002 at 11:31:29PM -0600, Mike Miller wrote:
> > > Try somethinglike s/,([A-Z])/,"$1/g
> > >
> > > The parantheses (sp?) are a grouping operator and tell vi
> > > to assign whatever matches the pattern inside them to the next
> > > group variable ($1, $2, $3, ...) The $1 of course then references
> > > the first grouping from the matching part of your re.
> >
> >
> > Do you know if this can also be done somehow in sed? I thought there
> > was a correspondence between vi and sed on this sort of thing but I
> > couldn't get sed to do this.
>
> Not sure, most of my regex experience comes from perl which uses egrep
> like regex's. Not sure how sed's regex support differs.
Oh, thanks, just tried it in perl instead of sed and it works beautifully!
I didn't know about this before and it is very helpful. Basic idea for
those not familiar, these two do basically the same thing:
sed 's/search/replace/g' filename
perl -e 's/search/replace/g' -p filename
Mike
--
To unsubscribe, go to http://mlug.missouri.edu/members/edit.php
Archives are available at http://mlug.missouri.edu/list-archives/