At 2005-01-18T15:37:17+1300, Ross Drummond wrote:
> The info page suggests that;
> sed -e s/\bcat\b/pussy/g
> will work, but doesn't.

You need to enclose the sed command in quotes, otherwise the shell
thinks you're using the backslash to escape the 'b', and strips it from
the input before it reaches sed(1).

$ set -x

$ echo "My cat is a ninja robot in disguise." | sed -e s/\bcat\b/pussy/g
+ echo 'My cat is a ninja robot in disguise.'
+ sed -e s/bcatb/pussy/g
My cat is a ninja robot in disguise.

$ echo "My cat is a ninja robot in disguise." | sed -e 's/\bcat\b/pussy/g'
+ echo 'My cat is a ninja robot in disguise.'
+ sed -e 's/\bcat\b/pussy/g'
My pussy is a ninja robot in disguise.

$ set +x

Cheers,
-mjg
-- 
Matthew Gregan                     |/
                                  /|                [EMAIL PROTECTED]

Reply via email to