fablefe 发表于 2017-7-8 19:51:02

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
页: [1]
查看完整版本: sed用法——在指定行后面添加内容