Reading a delimited file
Posted: 13 Jun 2018 01:32
I have a very unusual batch requirement.
I have file with a header and number of rows which are considered as data in the subsequent rows.
Number of header columns can vary and can be determined from the number of delimters. if there are three delimiters in a row - i will have four columns in the file.
The data rows(subsequent rows after the header) are not constant it can vary 2 to end of file
Sample file
Required Output will be header rows followed by subsequent rows.In the end of each row i will mention also the folder name(F1) and file name (u1.dat).
There are multiple files in each such folders.
Please how we can we transalate the requirement using batch to an above output.
I have file with a header and number of rows which are considered as data in the subsequent rows.
Number of header columns can vary and can be determined from the number of delimters. if there are three delimiters in a row - i will have four columns in the file.
The data rows(subsequent rows after the header) are not constant it can vary 2 to end of file
Sample file
Code: Select all
COMPID|COMPNAME|ADDRESS|YEAROFESTABLISTMENT
100|XYC|AWER RD|12072018
120|BNM|PQTY RD|12082018
Required Output will be header rows followed by subsequent rows.In the end of each row i will mention also the folder name(F1) and file name (u1.dat).
There are multiple files in each such folders.
Code: Select all
COMPID,COMPNAME,ADDRESS,YEAROFESTABLISTMENT##"100","XYC","AWER RD","12072018"##F1.u1
COMPID,COMPNAME,ADDRESS,YEAROFESTABLISTMENT##"120","BNM","PQTY RD","12082018"##F1.u1