linux系统中sed命令在数据中插入文件
1、测试数据
[root@PC3 test]# cat a.txt
Beijing 2003
Beijing 2004
Beijing 2005
Beijing 2006
Beijing 2005
Beijing 2008
[root@PC3 test]# cat c.txt
1
2
3
4
5
6
7
8
9
10
2、在匹配2004字符后插入c.txt
[root@PC3 test]# sed '/2004/r c.txt' a.txt
Beijing 2003
Beijing 2004
1
2
3
4
5
6
7
8
9
10
Beijing 2005
Beijing 2006
Beijing 2005
Beijing 2008
在匹配2005后插入c.txt
[root@PC3 test]# sed '/2005/r c.txt' a.txt
Beijing 2003
Beijing 2004
Beijing 2005
1
2
3
4
5
6
7
8
9
10
Beijing 2006
Beijing 2005
1
2
3
4
5
6
7
8
9
10
Beijing 2008