[linux] Re: leading zeros in awk opens verdwenen?

Hans Paijmans j.j.paijmans op uvt.nl
Vr Feb 8 12:48:48 CET 2008


Martijn van Oosterhout wrote:
> On Fri, Feb 08, 2008 at 11:54:49AM +0100, Hans Paijmans wrote:
>> awk '{printf("%02.2f\n",3/2)}' -
>>
>> zou toch 01.50 moeten geven? Ik krijg 1.50!
> Nee, de eerste 2 in de printf is voor de totale breedte van de output.
> Voor wat jij wil moet je:
> 
> awk '{printf("%05.2f\n",3/2)}' -
>

dank.


-- 
Dr. J.J. Paijmans
Tilburg University: Dept. of Linguistics & AI                013-4662693
Rijksdienst voor Archeologie, Cultuurlandschap en Monumenten 033-4227591
Maastricht University: IKAT, Faculty of General Sciences     043-3883477
Thuis: Kleine St.Jansstraat 3, 3811 HV  Amersfoort           033-4722579
http://paai.uvt.nl     http://paijmans.net          GSM: +31 621 961 083





More information about the Linux mailing list