Hi,
I have to manipulate a data file which say reads like this
{$index $value $error_on_value}
aa 4.56 0.7
bb 123.456 0.00987
cc 987654 321
.
.
in easily human readable format of type
aa 4.6(7)
bb 123.456(1)
cc 9.877(3)e+05
value rounded to 4.6 with error of 0.7 on the last significant digit.
In 2nd row, error is rounded off
in 3rd, exponential form suits better for this. but this is optional. (In awk, its printf with "%g" option )
I tried to play with awk, where I formatted first with say
'{printf "%d\t1.3e\t%1.0e\n",$1,$2,$3}'
then can manipulate to get it dirty way to the type mentioned in row 3.
I am sure there is smart way to do this. If I get any suggestion, it would greatly improve my experience, so thanks in advance.
ps: My actual data file has (2n+1) number of columns. 1st being index, then even ones are value and odd ones are error on that. Should there be smart way to ask script to sense "n" (say using awk NF), and aumate that, that would be cool.