i have a sample file that is structured like below, and i would like to perform some operations on it :
1112283569;AOEEEEAOAO.;300012299419;0030000302;ALLE;0.00;0.00;0.00;0.00;79149449.66;0.00;7914944
1112283569;AOEEEEAOAO.;300012;;;;AAAAA299419;*;;0.00;0.00;0.00;0.00;79149449.66;0.00;79149449.66
1112283569;AOEEEEAOAO.;*;*;;0.00;0.;;;;;;;;;00;0.00;0.00;79149449.66;0.00;79149449.66;0.00;79149
*;CON;*;0030000302;ΑLLEO;0.00;0.00;0.00;0.00;79149449.66;0.00;79149449.66;0.00;79149449.66;0.00
;CONE:;*;*;;0.00;0.00;0.00;0.00;79149449.66;0.00;79149449.66;0.00;;;79149449.66;0.00
I m trying to come up with a solution for this. I need to read a file that looks like the one above, delimited by ';' and i need to run a check on the character after the 3rd delimiter on each line at a time. It will not be in a static column, so i need some way to capture the character after the nth delimiter (;), i might be able do this with a regex (i think.)
Ie, for the above output :
Line 1 - Doesnt meet condition Line 2 - Doesnt meet condition Line 3 - Meets condition Line 4 - Doesnt meet condition Line 5 - Meets condition
Finally it would output something like :
1112283569;AOEEEEAOAO.;*;*;;0.00;0.;;;;;;;;;00;0.00;0.00;79149449.66;0.00;79149449.66;0.00;79149
;CONE:;*;*;;0.00;0.00;0.00;0.00;79149449.66;0.00;79149449.66;0.00;;;79149449.66;0.00
(Only the lines where the first character after the third delimiter is *) I ve found this type of regex, but i m not sure it would apply in this situation? :
/\%(^\%([^ ]* \)\{6\}\)\@<=.
Aucun commentaire:
Enregistrer un commentaire