mercredi 3 avril 2019

Parsing file of two formats and parse the line as well

I have an huge file which can have lines in below two formats:

Format1:

*1 <int_1/string_1>:<int/string> <int_2/string_2>:<int/string> <float>

Format2:

*1 <int/string>:<int/string> <float>

From both of these lines, I only need to consider 'Format1' for my code. While reading that huge file, skip the lines respective to 'Format2'. After considering the 'Format1' line, I will have to take two values from it:

int_1/string_1
int_2/string_2

What could have you done optimally to deal with it?

Aucun commentaire:

Enregistrer un commentaire