1.使用&命令附加修改字符
[root@acer shell_learning]# cat quote.txt | grep "nurse"
The local nurse Miss P.Neave was in attendance
[root@acer shell_learning]# sed -n 's/nurse/"Hello" &/p' quote.txt
The local "Hello" nurse Miss P.Neave was in attendance
[root@acer shell_learning]# sed -n 's/nurse/& "Hello"/p' quote.txt
The local nurse "Hello" Miss P.Neave was in attendance
由此可以知道&代替原来的字符“nurse”,如此一来,它前后要加字符就好说了。
阅读(942) | 评论(0) | 转发(0) |