in reply to Merge and split files based on number of lines
In principle what you describe is fairly trivial, but I wonder if there is a bigger picture here that is worth taking into account? Unless you are doing this as an exercise, splitting the files up sounds like the start of a processing pipeline. You may get significant advantage by combining processing steps in the pipeline by avoiding multiple reads and writes to disk for the same data. We can probably help you better if you describe the complete process.
Your problem specification isn't great. Do you want to combine files if they have fewer than the output number? If you aren't combining files do you want to write a short file when you run out of lines from the input file or do something else (if so, what)? How do you want the output files named? Do the output files go in the same folder as the input files?
|
|---|