我想将文本文件中的第n行重复m次,但是我做不到。我的文件是
#
1:host
1:host
#
我想重复"1:host"
,使我总共得到12行"1:host"
。
所以预期结果应该是:
#
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
这就是您要尝试的全部吗?
$ cat file
#
1:host
1:host
foo
$ awk 'NR==3{for (i=1; i<=10; i++) print} 1' file
#
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
1:host
foo