Ataualpa Albert Carmo Braga wrote at Fri, 20 Jun 2003 02:28:11 -0300:
> I did a small script with perl and I'd like to format the output:
>
> C -3.797516 2.078833 -0.795507
> C 4.046324 0.905644 -0.106181
> C 4.037286 0.887412 1.283492
> C -3.763395 2.049306 1.974280
> C 3.510738 3.243859 1.300844
> C 3.532632 3.241100 -0.087005
> S 4.426205 -0.568871 -1.005668
> O -4.671286 -0.193843 -2.360360
> C 3.247672 4.512625 2.076377
> [...]
>
> like this:
>
> C -3.797516 2.078833 -0.795507
> C 4.046324 0.905644 -0.106181
> C 4.037286 0.887412 1.283492
> C -3.763395 2.049306 1.974280
> C 3.510738 3.243859 1.300844
> C 3.532632 3.241100 -0.087005
> S 4.426205 -0.568871 -1.005668
> O -4.671286 -0.193843 -2.360360
> C 3.247672 4.512625 2.076377
>
>
> Is it possible?
printf and sprintf are youre friends (perldoc -f sprintf).
Look e.g. to:
Something like this snippet should give you the idea:
while (<DATA>) {
my @col = split;
printf " %-1s\t% 1.6f\t% 1.6f\t% 1.6f\n", @col;
}
__DATA__
C -3.797516 2.078833 -0.795507
C 4.046324 0.905644 -0.106181
C 4.037286 0.887412 1.283492
C -3.763395 2.049306 1.974280
C 3.510738 3.243859 1.300844
C 3.532632 3.241100 -0.087005
S 4.426205 -0.568871 -1.005668
O -4.671286 -0.193843 -2.360360
C 3.247672 4.512625 2.076377
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]