sed pattern matching

Hi,

I have a file which contains a word like ravi and ravi30.
i want to replace only the word ravi with xxx for that i am using the below sed command

sed -e 's/ravi/xxx/g' .

but the above command out put is xxx and xxx30 but i dont need to change ravi30

please guide me how to proceed.

Thank you very much in advance

You may want to add some blanks :wink:

[house@vici] echo "like ravi and ravi30" | sed -e 's/ ravi / xxx /g'
like xxx and ravi30

what you are looking for are word boundaries:

sed -e 's/\<ravi\>/xxx/g' /foo/bar

@ravi,

Try this one too..
sed 's/ravi/xxx/g;s/xxx30/ravi30/g' File_name

Hope it will work fine...

The word ravi and avi30 doesnt have any boundries
the two words are completely different