Need ideas for parsing a file
Hello everyone, this is my first post here, so if I'm doing something wrong or explaining myself wrong, please give me constructive criticism.
What I'm trying to do, is write a program that will rewrite my cell phone contact backup file from the format it is in presently, to a new format with a name on one line and the numbers on the following line.
The file presently looks like this:
Code:
R3,H609@ .УQ8G0\zht} 2
2 I BEGIN:VCARD
VERSION:3.0
N:Aaron;;;;
TEL;VOICE:1561620191
END:VCARD
K BEGIN:VCARD
VERSION:3.0
N:Aaron H;;;;
TEL;VOICE:1561399224
END:VCARD
H BEGIN:VCARD
VERSION:3.0
N:Adam;;;;
TEL;VOICE:1772240172
END:VCARD
I BEGIN:VCARD
VERSION:3.0
N:Admjgt;;;;
TEL;VOICE:503733382
END:VCARD
` BEGIN:VCARD
VERSION:3.0
N:Alcohol Tobacco And Firearms;;;;
TEL;VOICE:18008003855
END:VCARD
G BEGIN:VCARD
VERSION:3.0
N:Aleisha;;;;
TEL;VOICE:418940
END:VCARD
P BEGIN:VCARD
VERSION:3.0
N:Alex De Vries;;;;
TEL;VOICE:772856317
And I want it to look like this:
Code:
1:Aaron
-1:1562620191
2:Aaron H
-1:1561399224
3:Adam
-1:1772340172
4:Admjgt;;;;
-1:503733382
-2:561456754
I've removed a digit from each number just for my own security.
Basicly, I have a moderate knowledge of programming, but I don't know that much about string functions; and I only know a bit about file operations.
I've heard something about reading files to the effect of being required to read the file bit by bit because you can't open the entire thing at once. Is this true?
What I'm looking for is a basic idea about how I would go about this, and what functions I would use.
Thanks in advance,
-Primux