항목을 분할하지 않고 6GB 또는 7GB 파일을 2GB보다 작은 여러 파일로 분할하려면 어떻게 해야 합니까?

항목을 분할하지 않고 6GB 또는 7GB 파일을 2GB보다 작은 여러 파일로 분할하려면 어떻게 해야 합니까?

내 레벨은 6~10GB 파일을 입력으로 사용합니다. 이러한 파일에는 여러 줄의 데이터가 포함되어 있습니다. 다음 레벨의 최대 입력 용량은 2GB입니다. 따라서 이 6~10GB 파일을 줄 바꿈 없이 여러 개의 2GB 미만 파일로 분할해야 합니다! 기본적으로 파일을 크기에 따라 분할해야 하지만 줄 바꿈은 할 수 없습니다.

답변1

2GB보다 큰 행이 없으면 다음을 사용할 수 있습니다.

split --line-bytes=2GB

정보 책자에서:

‘--line-bytes=SIZE’
 Put into each output file as many complete lines of INPUT as
 possible without exceeding SIZE bytes.  Individual lines or records
 longer than SIZE bytes are broken into multiple files.

답변2

나는 이것이 당신이 필요로 하는 일을 거의 해낼 것이라고 믿습니다.

split -n

-n, --number=CHUNKS
              generate CHUNKS output files.


CHUNKS may be: 
N       split into N files based on size of input
K/N     output Kth of N to stdout
l/N     split into N files without splitting lines
l/K/N   output Kth of N to stdout without splitting lines
r/N     like 'l' but use round robin distribution
r/K/N   likewise but only output Kth of N to stdout

관련 정보