I have a requirement in which I have to split the file contents based on value of the first column of the comma separated values in the source file.
Number of files to be generated in output depends on the number of unique values in the first column.
Eg:
FileName.txt
Code001,value11,value12,value13,value14
Code002,value21,value22,value23,value24
Code003,value31,value32,value33,value34
Code001,value15,value16,value17,value14
Code003,value37,value38,value39,value31
Output has to be number of files as the unique values in first column of the file content.
Ex Output: It should be 3 seperate files with name and contents as below
Code001.txt
Code001,value11,value12,value13,value14
Code001,value15,value16,value17,value14
Code002.txt
Code002,value21,value22,value23,value24
Code003.txt
Code003,value31,value32,value33,value34
Code003,value37,value38,value39,value31
Aucun commentaire:
Enregistrer un commentaire