#!usr/local/perl 
use strict;
### Make the gram data files




my $j;

my $head;
$head='RF = RealField\(1000\)  AI = [20]*25  MAXERR = dict\(\)';

my $k;

for ($j=20; $j<=30; $j=$j+2) {
    $k=$j-1;
    `echo $head > gram_data.$j.sage`;
    `cat PS_Gram-inv*-$k*txt >> gram_data.$j.sage`;
    `cat PS_Gramda*-$k*txt >> gram_data.$j.sage`;
    `sed -i 's/ AI/\\n\\nAI/mg' gram_data.$j.sage`;
    #`sed -i 's/^1:/\n\n GRAM_DATA=\{1:/mg' gram_data.$j.sage`;
    `sed -i 's/^1:/GRAM_DATA={1:/mg' gram_data.$j.sage`;
    `sed -i '\$\{s/)\,\$/)\\}/\}' gram_data.$j.sage`;
    `cat PS_Gramerr*-$k*txt >> gram_data.$j.sage`;
    `sed -i 's/MAX/\\nMAX/mg' gram_data.$j.sage`;
    `sed -i 's/\\[0\\([1-9]\\)/[\\1/mg' gram_data.$j.sage`;
    `sed -i 's/\\]\\[/,/mg' gram_data.$j.sage`;
#    `sed -i 's/AI/BI/' gram_data.$j.sage`;
}


exit(0);
