2006-11-25 13:07:29 -07:00
|
|
|
#!/bin/sh
|
|
|
|
awk '
|
2015-05-10 03:59:07 -06:00
|
|
|
/^ 1/ && READY == 0 { printf (" 1 ");
|
2006-11-25 13:07:29 -07:00
|
|
|
for (i = 2; i < NF; i++)
|
2015-05-10 03:59:07 -06:00
|
|
|
printf (" %2d ", i);
|
|
|
|
printf (" Operation\n");
|
2006-11-25 13:07:29 -07:00
|
|
|
next;
|
|
|
|
}
|
2015-05-10 03:59:07 -06:00
|
|
|
/^---/ { printf ("------------");
|
2006-11-25 13:07:29 -07:00
|
|
|
for (i = 2; i <= NF; i++)
|
2015-05-10 03:59:07 -06:00
|
|
|
printf (" -------------------------");
|
2006-11-25 13:07:29 -07:00
|
|
|
printf ("\n");
|
|
|
|
READY=1; next;
|
|
|
|
}
|
|
|
|
READY==1 {
|
|
|
|
base=$1;
|
2015-05-10 03:59:07 -06:00
|
|
|
printf ("%12.1f", base);
|
2006-11-25 13:07:29 -07:00
|
|
|
for (i = 2; i < '$1'; i++) {
|
|
|
|
if (base == 0)
|
2015-05-10 03:59:07 -06:00
|
|
|
printf (" %12.1f ", $i);
|
2006-11-25 13:07:29 -07:00
|
|
|
else {
|
|
|
|
rate=$i/base;
|
2015-05-10 03:59:07 -06:00
|
|
|
printf (" %12.1f (%10.3f)", $i, rate);
|
2006-11-25 13:07:29 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
printf (" ");
|
|
|
|
for (; i <= NF; i++)
|
|
|
|
{
|
|
|
|
printf ("%s ", $i);
|
|
|
|
}
|
|
|
|
printf ("\n");
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
{ print $0; }
|
|
|
|
'
|