How can I split and write the output of my command in Linux bash, to multiple (text) 5M files (number of files does not matter)?
Pipe its output to split
.
Example:
$ my-command-name-here | split -a 3 -b 5g - myFile.
will produce files of 5GB having the names myFile.aaa
, myFile.aab
, myFile.aac
a.s.o.
Use -l
instead of -b
to produce files with the specified number of lines instead of bytes.
Read man split
or the online documentation.