Hi,
I have an array that contains around five-hundred-thousands values (sorted by numbers). I want to get the value from the array and writing values by splitting into multiple files. My conditions are:
- I want to write 50000 array rows to each file sequentially giving file numbers X_1, X_2 ... X_10 etc.
- One file can contain "multiple ID" that comes sequentially
- But, "Multiple files" cannot contain "same ID" (value)
- If going to 50000th line in array we see next-few-rows has same values as 50000th line, we will include them for writing into same file, cannot take same ID to another file
- so, we will write (50000 values) OR (50000 values + continuation of same value) to one file
This is a part of a big process, i was able to build until the array, but now facing trouble to write those values splitting into files following the logic. Anyone can help?
Sample Array ($a):
9001
9001
9001
9001
9002
9002
9003
9003
9003
9003
9003
9004
9004
9004
9004
9004
9004
9004
9005
9006
9006
9006
I have an array that contains around five-hundred-thousands values (sorted by numbers). I want to get the value from the array and writing values by splitting into multiple files. My conditions are:
- I want to write 50000 array rows to each file sequentially giving file numbers X_1, X_2 ... X_10 etc.
- One file can contain "multiple ID" that comes sequentially
- But, "Multiple files" cannot contain "same ID" (value)
- If going to 50000th line in array we see next-few-rows has same values as 50000th line, we will include them for writing into same file, cannot take same ID to another file
- so, we will write (50000 values) OR (50000 values + continuation of same value) to one file
This is a part of a big process, i was able to build until the array, but now facing trouble to write those values splitting into files following the logic. Anyone can help?
Sample Array ($a):
9001
9001
9001
9001
9002
9002
9003
9003
9003
9003
9003
9004
9004
9004
9004
9004
9004
9004
9005
9006
9006
9006