Sed question

Dave Tiger dave at tigeri.com
Thu Apr 15 16:15:51 BST 2004


Hi Sam,

 cat filename | sed -e "s/domain.com-edit\/1s/^L^Mtext to add/" filename

Added the pipe as a friend called me up and told me to but all I get is =
the
file streaming to the screen and not writing the as expected text :-(

I know I am so close to this and I ask if you or the list have the =
answer to
this so I can move on.=20

I took out the $ in your exapmle because it errored say invalid variable
name.

Thank you for your previous help.

Dave C

-----Original Message-----
From: Sam [mailto:freebsd at pikesley.org]=20
Sent: 15 April 2004 15:37
To: Dave Tiger
Cc: freebsd-users at uk.freebsd.org
Subject: Re: Sed question


On Thu, 2004-04-15 at 15:25, Dave Tiger wrote:
> Hi Again,
>=20
> Sorry to be a bore but I cant get my head around sed and adding text=20
> to a file using it.
>=20
> I need to find the instance of "domain.com-edit" which is at the end=20
> of a line in a file and add a line of text under it.
>=20
> Sed -e "domain.com-edit" -e "s/text to add/g" filename

	sed -e "s/\(domain.com-edit\)$/\1^L^Mtext to add/" <filename>

Where ^L^M is actually the following sequence:=20

	"Ctrl-V Ctrl-L Ctrl-V Ctrl-M"

I'm sure there's a sed ninja reading this who knows a better way to do =
it,
but it Works For Me...

> =20
>=20
> Dose not work, I got the example of a website.
>=20
> Any help with this last piece of the puzzle is appreciated.
>=20
> Thank you in advance
>=20
> Dave C
>=20
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.657 / Virus Database: 422 - Release Date: 13/04/2004
> =20
>=20
>=20
> ------ FreeBSD UK Users' Group  -  Mailing List ------=20
> http://listserver.uk.freebsd.org/mailman/listinfo/freebsd-users
--=20
Sending this message was important to us. We considered ourselves to be =
a
powerful culture.

                    http://downlode.org/etext/wipp/


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.657 / Virus Database: 422 - Release Date: 13/04/2004
=20

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.657 / Virus Database: 422 - Release Date: 13/04/2004
=20





More information about the Ukfreebsd mailing list