Hi everyone,
I have this sample text file with the following format:
- 1st line: the number of PAR blocks
- 2nd-3rd line: name and some corresponding parameters
- Next 5 lines: array of 5 x 10 elements
I was wondering what would be the best way to read this kind of text file? My actual file has about 100 million lines. My current approach is to read the whole file in with scan()
then step by step cycle through each block but it's slow
Any suggestion appreciated!
3
PAR01
CONST 3 F4.0 6
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0
PAR02
CONST 3 F4.0 6
000.0 000.0 000.0 000.0 000.0 000.0 000.0 000.0 000.0 000.0
000.0 000.0 000.0 000.0 000.0 000.0 000.0 000.0 000.0 000.0
123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0
123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0
123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0
PAR03
CONST 3 F4.0 6
123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0 123.0
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0
111.0 111.0 111.0 111.0 111.0 111.0 111.0 111.0 111.0 111.0
111.0 111.0 111.0 111.0 111.0 111.0 111.0 111.0 111.0 111.0
999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0 999.0