hi below
perl may help you a little
usage:
perl a.pl NUM FILE1 FILE2 [here NUM indicate how many lines will be header]
Code:
a:
*****
line 1
line 2
1 2 3 4 5
Code:
b:
*****
line 3
line 4
9 8 7 6 5
output:
Code:
*****
line 1
line 2
line 3
line 4
10 10 10 10 10
Code:
$header=shift;
undef $/;
my(@head,@body,@foot);
while($file=shift){
open FH,"<$file" or die "Can not open file $_";
my $str=<FH>;
close FH;
my @temp=split("\n",$str);
for( my $i=0;$i<$header;$i++){
push @head,$temp[$i] if ($#head<$header-1);
}
for(my $j=$header;$j<$#temp;$j++){
push @body,$temp[$j];
}
my @footer = split(" ",$temp[$#temp]);
for($k=0;$k<=$#footer;$k++){
$foot[$k]=$foot[$k]+$footer[$k];
}
}
print join "\n",@head;
print "\n",join "\n",@body;
print "\n",join " ",@foot;