sed 引入变量时,需要使用三引号,格式为三个单引号,或者单引号内套一个双引号!!!
[root@controller ~]# cat test.txt 123 456 789 [root@controller ~]# sed -i 's/3/'''c'''/' test.txt [root@controller ~]# cat test.txt 12c 456 789 [root@controller ~]# sed -i 's/6/'"f"'/' test.txt [root@controller ~]# cat test.txt 12c 45f 789 [root@controller ~]# sed -i 's/9/"'i'"/' test.txt [root@controller ~]# cat test.txt 12c 45f 78"i" [root@controller ~]#
标签:变量,引号,cat,controller,sed,test,txt,root From: https://www.cnblogs.com/santia-god/p/17468262.html