sed "s/regex/replace/" => sed "s|regex|replace|"
参考:
https://stackoverflow.com/questions/40714970/escaping-forward-slashes-in-sed-command/40715028
sed "s/regex/aaa&bbb/" => sed "s/regex/aaa\&bbb/"
开头插入字符串:
cat file.txt | sed -e "s|^|/home/|g"
结尾插入字符串:
cat file.txt | sed -e "s|$|/dir/|g"
[
本帖最后由 linda 于 2023-3-22 15:43 编辑 ]