So I have data (in a file) like this:
A1
F 1
G 2
H 3
A2
F 2
G 5
H 9
B1
F 6
G 3
H 7
B2
4
0
1
Ans I want to switch it up so that it's like this:
A1 A2 A3 A4
F 4 6 3 5
G etc.
H
What's the best/most efficient way to do this? I figure I could loop over the input file once for row F once for row G, etc. I also figure I could read the file just once and store all the data in a hash or arrays. Then print my variables back to the output file.
I'm concerned about time/memory because this script will work on LARGE files. It is possible that the input file could be HUGE, like 1-GB, so in that case I think I have no choise but to loop over the file several times?
Thanks guys!
A1
F 1
G 2
H 3
A2
F 2
G 5
H 9
B1
F 6
G 3
H 7
B2
4
0
1
Ans I want to switch it up so that it's like this:
A1 A2 A3 A4
F 4 6 3 5
G etc.
H
What's the best/most efficient way to do this? I figure I could loop over the input file once for row F once for row G, etc. I also figure I could read the file just once and store all the data in a hash or arrays. Then print my variables back to the output file.
I'm concerned about time/memory because this script will work on LARGE files. It is possible that the input file could be HUGE, like 1-GB, so in that case I think I have no choise but to loop over the file several times?
Thanks guys!