[Discuss] sed and ANSI sequences

Derek Martin invalid at pizzashack.org
Tue Oct 18 11:22:50 EDT 2011


On Mon, Oct 17, 2011 at 01:13:29PM -0400, Ricker, William wrote:
> > $ echo "hello my bold friend" |sed 's/bold/\033[1mbold\033[0m/g'
> > hello my bold33[1mboldbold33[0m friend
>
> I suspect echo protects youu fromm escapes unless specified with -e \e. 
> 
> The octal is better with sed/perl filter. 

Note that in the pipe above, the execution of echo has terminated
prior to sed running, and the string emitted by echo contains no
escapes, neither before nor after echo treats it.  The octal is in the
sed command, and arrives in sed unaltered by the shell.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



More information about the Discuss mailing list