Jonathan Leffler Jonathan Leffler k gold badges silver badges bronze badges. Also in above line did you meant or , as bytes is the avg per line. And -C option is not supported when i tried to use csplit as you mentioned in your answer.
The intention was to get lines, each of about bytes, and split them into 10 files of up to bytes each. If any line is longer than bytes, then that line will be split. Otherwise, this will avoid splitting lines. If you got files, then either I miscalculated the bytes per line of your initial rows in the file are long sufficiently long that two lines don't fit into bytes, so over bytes each, roughly speaking.
You said lines and Also, csplit is a context-split command and I never suggested using it. You told me that split -C was supported on your machine. If it isn't, then either you need to get GNU split which does support it; it is a part of the GNU CoreUtils package and install it, or you have to go back to your calculations.
If that's too big, scale the number to or maybe What you choose depends on the consequences of choosing a file size that's too big or too small. If that doesn't work sanely, your input lines are very non-uniform. Maybe you need to generate a histogram of the line lengths so you can work out what might be acceptable.
Maybe you need to randomize the file before processing it further. I do think this is all stuff I covered in my first comment albeit very tersely nearly 4 days ago. You have to know what your tools can do, and you have to know the shape and size of your data files. This command serves your purpose. Thanks Venkat, but if you read my question again. I said requirement is to split the file by no of lines, in the process also make sure that after splitting the file sizes is less than 2GB.
Off course i know i can do it by giving the byte size. I have done my research before posting the question. Note that split -b breaks at a byte count, part way through a line if need be.
That is not what is wanted. Sign up or log in Sign up using Google. Sign up using Facebook. Check out our list of the best free tools for Windows. Give your archive a name. Under Split to Volumes, bytes , input the size of split files you want. There are several options in the dropdown menu, although they may not correspond to your large file. Press OK when you are ready and let 7-Zip split your large file into smaller bits. With FFSJ, you can:.
There is also the option to delete the source file after splitting the file, or to encrypt the output files for extra protection. If you choose to encrypt the files, you must enter a password before the file splitter begins.
To split a large file with FFSJ, select your input file, then the output file location. Browse to the folder containing the first split file part, then add an output folder for your reconstructed files.
You have several options to split a file into multiple files. The three options are easy to use and have different file splitting options. For instance, you can use 7-Zip to split and compress your output files, potentially saving space on your hard drive.
Check out the best ways to send large files as email attachments. Gavin is a professional technology writer with a decade of experience covering security, gaming, cryptocurrencies, Windows, and Linux, plus some diversions into copywriting for real estate, sports, and PC hardware businesses. FileOutputStream; import java. FileWriter; import java. IOException; import java.
InputStreamReader; import java. Vishal Zanzrukia. Vishal Zanzrukia Vishal Zanzrukia 4, 4 4 gold badges 34 34 silver badges 74 74 bronze badges.
Unfortunately, It's not possible to open such big file with any of my editors : — Vishal Zanzrukia. Try Glogg glogg. But need to pay for it, but trial version — Danielson. You should try a smaller test case - try smaller file with similar contents, or only look at the first 10K of the big file for example. Then you can inspect the output yourself and see where the problems are. Why are you suddenly reading by line using a reader instead of by bytes like how you split the file.
Your joinFiles method looks much better than your mergeFiles method, except it will merge the files possibly in the wrong order.
Add a comment. Active Oldest Votes. Erwin Bolwidt Erwin Bolwidt Download Puran Splitter. One of the most known methods of splitting files into multiple parts is by using a file archiver. Most archiving software has the ability to create a multi part Zip or 7z archive. PeaZip is also a very good general archiver with a portable version if you would rather not install it.
To create a multi part archive, press Add , and drop the file onto the window. Choose where to save the split files, and in the dropdown boxes select Self-extracting 7Z , and Store.
With the self extracting 7Z you can join the files back together without an archiver installed. To create a standard split file, choose Split in the top drop down and pick the split size in the bottom drop down and start the process. The PeaUtils window is also where you can join split parts together again. Click the drop down and select Join spanned file , then locate the first file in the set. Therefore, you can use split, join, or any other options available in the drop down without using or installing PeaZip.
Freecommander XE still has the feature to split and combine files, just not with the icon like in your screenshot. Split and combine were added to XE in build released in excluding beta or donor versions , about a year after we wrote the article. The options had not been implemented in the free version up until that point.
0コメント