Using Perl it could be done with a readaptation of this:
#!/usr/bin/perl
use strict;
use warnings;
my @lines = ('CHO 1', '4096', #simulate line-by-line loading of the file
'26 20 0 0 0 0 0 0 0 0',
'0 0 0 0 0 3 5 15 8 14',
'9 7 13 10 12 9 5 3 3 2',
'2 0 0 0 0 0 0 1 1 0',
'0 0 0 0 0 0 0 0 0 0',
'0 0 0 0 1 0 1 0 0 0',
'0 0 0 0 0 0 1 0 0 0',
'0 0 0 0 1 0 0 0 0 0',
'6 8 5 5 7 13 13 33 23 29',
'44 51 56 42 39 31 21 24 18 18',
'18 30 44 43 51 67 102 110 130 130',
'100 96 87 49 25 16 4 1 1 0',
'0 0 0 0 0 0');
my $first_line = shift @lines; #removes CHO 1
my $stop = shift @lines; #removes 4096
my $i = 0;
foreach my $line (@lines) {
$line =~ s/^\s*//;
$line =~ s/\s*$//;
my @parts = split(/\s+/, $line);
foreach my $part (@parts) {
print "$i $part\n"; #prints to stdout, maybe you want to print into a file
$i++;
}
}
and this is the output:
0 26
1 20
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 3
16 5
...
125 0
...