![](/img/trans.png)
[英]to copy specific line numbers from one file to specific line numbers of another file using awk
[英]Add text from a file b/w two specific line numbers using linux (sed,awk)?
我有一个文件的特定行号,想插入另一个文件的内容 b/w 这两个行号
例如-
要插入的文件
$ cat insert.txt
1
2
3
在以下文件中
$cat File.txt
a
b
c
d
e
如何插入文件 insert.txt b/w 的第 3 行和第 4 行的内容? Output:
a
b
c
1
2
3
d
e
您可以使用地址为3
(第三行)的 sed 和命令r
来读取文件:
sed '3 r insert.txt' File.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.