Break large file down into multiple files
Tim Chase
python.list at tim.thechases.com
Fri Feb 13 06:38:06 EST 2009
> New to python.... I have a large file that I need to break up
> into multiple smaller files. I need to break the large file
> into sections where there are 65535 lines and then write those
> sections to seperate files. I am familiar with opening and
> writing files, however, I am struggling with creating the
> sections and writing the different sections to their own
> files.
While this thread has offered many nice Python solutions, the
"split" command is pretty standard on most Linux boxes:
bash$ split -l 65535 infile.txt
which will do what you describe. You can read the man page for
more details.
So if you just want a fast route to a goal rather than going
through the learning process (I'm all for learning how to do it
too), this may be a quick answer.
-tkc
More information about the Python-list
mailing list