10.3.6 读入文本

使用r命令可从其他文件中读取文本,并插入匹配行之后,示例如下:


#

etcpasswd 中的内容读出放到Sed.txt 空行之后

[root@localhost ~]# sed '^$r etcpasswd' Sed.txt this is line 1, this is First line this is line 2, the Second line, Empty line followed root:x:0:0:root:/root:/bin/bash ……(

略去内容)……

apache:x:48:48:Apache:/var/www:/sbin/nologin this is line 4, this is Third line this is line 5, this is Fifth line