sed用法——在指定行后面添加内容

文档内容如下:

# cat 123.txt
linux
cisco
huawei
network
system

1. 使用sed命令在cisco行下面添加CCIE;

# sed -i "/cisco/a\CCIE" 123.txt
# cat 123.txt
linux
cisco
CCIE
huawei
network
system

2. 使用sed命令在network行上面添加一行,内容是Security;

# sed -i "/network/i\Security" 123.txt
# cat 123.txt
linux
cisco
CCIE
huawei
Security
network
system

 

posted @ 2017-05-04 18:20  小小土憨巴  阅读(8741)  评论(0编辑  收藏  举报