アイテムを分割せずに6 GBまたは7 GBのファイルを2 GB未満の複数のファイルに分割するにはどうすればよいですか?

アイテムを分割せずに6 GBまたは7 GBのファイルを2 GB未満の複数のファイルに分割するにはどうすればよいですか?

私のレベルは6〜10 GBのファイルを入力として使用します。これらのファイルには複数行のデータが含まれています。次のレベルの最大入力容量は2GBです。したがって、この6〜10 GBのファイルを改行なしで複数の2 GB未満のファイルに分割する必要があります!デフォルトではファイルをサイズに応じて分割する必要がありますが、改行はできません。

答え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

関連情報