![파일을 분할하는 방법은 무엇입니까?](https://linux55.com/image/45926/%ED%8C%8C%EC%9D%BC%EC%9D%84%20%EB%B6%84%ED%95%A0%ED%95%98%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
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