Say, I have a command command
which prints huge number of lines to stdout:
line1
line2
.....
lineN
I want to save the output to disk, but not as a single file, but as a sequence of files each having 1000 lines of stdout:
file0001.txt:
-------------
line1
....
line1000
file0002.txt:
-------------
line1001
....
line2000
etc
I've tried to google the answer, but every time google points me to tee
command, which is useless in this situation. Probably, I'm entering wrong queries.
split [arguments...] [input e.g. "-" for stdin] [output_prefix]
, for example:tar -c somedir | split --byes 100MB --numeric-suffixes --suffix-length=3 - somedir.tar.part-
would output a bunch of 100MB files namedsomedir.tar.part-000
, 001, 002 ans so on. – ThorSummoner Aug 17 '17 at 19:47--bytes
? – Qin Heyang Nov 05 '20 at 02:05