Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个命令:
sed -i "s/a:b/b:c/g" file.txt
(英文:将file.txt中的“a:b”替换为“b:c”)
由于替换文本中的冒号,这不起作用。我应该如何重新编写命令?
如果你想安全,你可以避开:冒号
:
sed -re "s/a\:b/b\:c/g" temp.txt
这对我有用:
-->cat 1 a:bLINE1 a:bLINE2 -->cat 1 | sed 's/a:b/b:c/g' b:cLINE1 b:cLINE2