Input.txt
:
line.....1
line.....2
line.....3
.....
line.....3
line.....4
line.....5
.....
line.....4
line.....5
line.....6
.....
line.....5
line.....6
line.....7
.....
中提到的输出文件名的条件name.txt
。
name.txt
:
chapter01.txt
chapter02.txt
chapter03.txt
chapter04.txt
需要以下txt
文件的输出
chapter01.txt
:
line.....1
line.....2
line.....3
.....
chapter02.txt
:
line.....3
line.....4
line.....5
.....
chapter03.txt
:
line.....4
line.....5
line.....6
.....
chapter04.txt
:
line.....5
line.....6
line.....7
.....
答案1
awk -vRS= '{RS="\n";getline f < "name.txt";RS=""
print > f; close(f)}' < input.txt