Author: abdulrafi
Subject: splitting a file
Posted: Fri Mar 24, 2017 11:51 am (GMT 5.5)
Hi,
I do have an input file. I have to split the files based on a key and send it to FTP server. Issue here is I am not sure of how many unique keys the input file will have. if there are 3 keys then 3 files needs to be created. If there are 5 keys, 5 files needs to be created.
Could anybody suggest me a way.
Here the keys are 21810, 21811, 21812. I am sure I can pad this keys towards the end with some sequence no and get it in 3 separate files.
But when I execute it next time there can be 10 keys present. How to dynamically define the file names to get the data separately in 10 separate files ?.
_________________
Thanks,
Abdul Rafi
Subject: splitting a file
Posted: Fri Mar 24, 2017 11:51 am (GMT 5.5)
Hi,
I do have an input file. I have to split the files based on a key and send it to FTP server. Issue here is I am not sure of how many unique keys the input file will have. if there are 3 keys then 3 files needs to be created. If there are 5 keys, 5 files needs to be created.
Could anybody suggest me a way.
Code: |
06F72600015908473 21810 1* 0559002GR GGL20L-CWZGBA 032317H 2ZZMCA0055900021017 B2* 01J4LB23 06 20170210 06F77400015908476 21810 1* 0559002GR GGL25L-CWZGBA 032317H 2BZMCA0055900021317 B2* 0083LC30 06 20170213 06F82400015908475 21811 1* 0559002GR GGL20L-CWZGBA 032317H 2ZZMCA0055900021117 B2* 04U7LA40 06 20170211 06F72600015908473 21812 1* 0559002GR GGL20L-CWZGBA 032317H 2ZZMCA0055900021017 B2* 01J4LB23 06 20170210 |
Here the keys are 21810, 21811, 21812. I am sure I can pad this keys towards the end with some sequence no and get it in 3 separate files.
But when I execute it next time there can be 10 keys present. How to dynamically define the file names to get the data separately in 10 separate files ?.
_________________
Thanks,
Abdul Rafi