Date: Tue, 19 Jun 2007 21:50:12 +0100 From: "Frank Shute" <frank@esperance-linux.co.uk> To: Olivier Regnier <oregnier@oregnier.net> Cc: freebsd-questions@freebsd.org Subject: Re: problem with sed substitution Message-ID: <20070619205012.GA6984@melon.esperance-linux.co.uk> In-Reply-To: <46780B29.7000004@oregnier.net> References: <46780B29.7000004@oregnier.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jun 19, 2007 at 06:58:17PM +0200, Olivier Regnier wrote: > > Hi everyone, > > I try to use sed with /etc/gettytab file. I would like to replace this > text : > \r\n%s\%m ($h) (%t)\r\n\r by Hello world. > I tested with this command : > % sed -i.old -e 's/\r\n%s\%m ($h) (%t)\r\n\r/Hello world/' > but that doesn't work at all. > Can you help me please ? > > Thank you :) > You have to backslash escape the characters "\()% " So eg: cat /etc/gettytab | \ sed -E 's/\\r\\n\%s\/\%m\ \(\%h\)\ \(\%t\)\\r\\n\\r/Hello world/' > ~/new_getty PS: I checked it on my gettytab which looks like it's a bit different to yours. BTW, re_format(7) is worth a look. -- Frank echo "f r a n k @ e s p e r a n c e - l i n u x . c o . u k" | sed 's/ //g' --->PGP keyID: 0x10BD6F4B<---
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070619205012.GA6984>