如何用sed替换3个字母的单词?

时间:2013-05-02 18:30:20

标签: linux unix sed

我需要使用sed来替换以og结尾的3个字母单词,并使用单词frog。我认为这样可行:

sed 's/?og/frog/' filename

但它没有?

1 个答案:

答案 0 :(得分:2)

这可能适合你。

sed 's/\<.og\>/frog/g' filename

.      matches one character 
\<     beginning of word anchor
\>     end of word anchor