gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 09:45:57 25 4
gpt4 key购买 nike

我需要使用 sed 将以 og 结尾的 3 个字母单词替换为单词 frog。我认为这会起作用:

sed 's/?og/frog/' filename

但事实并非如此?

最佳答案

这对你有用。

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

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

关于linux - 如何使用 sed 替换 3 个字母的单词?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16345230/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com