From: Steven Elling <ellings@kcnet.com> Subject: Re: Appending text in a file Date: Sat, 26 Apr 2003 02:27:53 -0500 Message-Id: <200304260227.47040.ellings@kcnet.com>
On Friday 25 April 2003 17:03, Jason Clinton wrote:
> Steven Elling wrote:
> > Just do the following in your case:
> >
> > cat old.ldif | \
> > sed -e 's/\(dn:.*\)/\1,ou=contacts,dc=tarcanfel,dc=net/' > new.ldif
>
> Hehe. "Just..." If it's any consolation, Jonathan, I look at lines like
> this and my eyes cross too. :)
Just be glad this substitute expression doesn't suffer from the leaning
toothpick syndrome.
As a side note: I did not realize it at first, but, you can use more than just
the forward slash to delimit the pieces of the expression. The above will
work this way too:
cat old.ldif | \
sed -e 's#\(dn:.*\)#\1,ou=contacts,dc=tarcanfel,dc=net#' > new.ldif
Notice how I used the hash mark to delimit the pieces of the expression.
Sometimes this makes substitute expressions a little easier to read when
using a lot of slashes and back-slashes.