Why the  \b  ?

echo "apple cat dog" |  sed s/cat/pussy/g
Works fine for me.

echo "apple cat dog" |  sed [EMAIL PROTECTED]@[EMAIL PROTECTED]
echo "apple cat dog" |  sed s-cat-pussy-g
echo "apple cat dog" |  sed szcatzpussyzg

In fact almost any character can be used as long as its not in either
string.

-----Original Message-----
From: Ross Drummond [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 18 January 2005 3:37 p.m.
To: CLUG mailing list
Subject: sed How do I replace whole word.


I am using sed, string replace.

How do I use this to find occurrences of a whole word such as cat without 
getting hits on words like cattle, which have the string cat embedded in the

word?

The info page suggests that;
sed -e s/\bcat\b/pussy/g
will work, but doesn't.

Cheers Ross Drummond

Reply via email to