I have some text files that are 100 to 300 MB in length that I want to view in Emacs, but my Emacs gets into some performance issues opening and traversing such large files. Therefore, I'm looking for an easy utility to split a file up into manageable chunks, say 50 MB each and to name the chunks based upon the original name plus some suffix to indicate their location in the sequence. Each chunk would pick up where the prior one was truncated and be no longer than 50 MB, with the last chunk possibly being shorter.
Is there any easy tool to do such on a Linux computer, perhaps something like head or tail that gives multiple results, one for each chunk?
e.g., given file
test.out that is 120 MB long, break it up into
test.out.1 for the first 50 MBs,
test.out.2 for the second 50 MBs, and
test.out.3 for the remainder 20 MBs at the end of the file.
I could use combinations of
tail to get the pieces, but I'd like a tool that abstracts this all out, perhaps a Perl script or Python script someone has already created to do such a task?