文档内容如下:
# cat 123.txt
linux
cisco
huawei
network
system
1. 使用sed命令在cisco行下面添加CCIE;
# sed -i "/cisco/aCCIE" 123.txt
# cat 123.txt
linux
cisco
CCIE
huawei
network
system
2. 使用sed命令在network行上面添加一行,内容是Security;
# sed -i "/network/iSecurity" 123.txt
# cat 123.txt
linux
cisco
CCIE
huawei
Security
network
system