Re: Another number fomatting question



In article <47505D8B.1060105@xxxxxxx>, Hermann Peifer <peifer@xxxxxxx> wrote:
Hello,

I was wondering if there is an easy way to align numbers with varying
precision at the decimal point.

Examples:

111.1111
2.222222
-33333.3
44444444

...which should look like:

111.1111
2.222222
-33333.3
44444444

(I don't want to add trailing 0's, but rather leave the numbers as they
are.)

Thanks in advance, Hermann

Here's a brute force approach (I put your list of numbers into a file,
fed as input to this [GAWK] script):

{split($1,T,".");printf("%10d%s\n",T[1],2 in T ? "."T[2] : "")}

Note that the "10" is a parameter...

.