[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf doesn't zero-pad strings
From: |
tink |
Subject: |
Re: printf doesn't zero-pad strings |
Date: |
Fri, 11 Aug 2023 21:32:07 +1200 |
On Fri, 11 Aug 2023 at 20:07, Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
> Both the gawk User Manual and "man -s 3 printf" document that the modifier
> "0" only applies to numeric formats, which "%s" most certainly is not.
> This is a feature simply taken over from C and implemented using its
> library.
> -W
>
Assuming that the gawk maintainers do indeed know better than the other
folk out there - should it then not issue an error/warning rather than just
padding with spaces instead of zeros?
In terms of "certainly not" - you're quite right. But it would still be
nice to be able to pad the hex digits 'a'-'f' with a zero without complex
work-arounds when they occur in input one needs to process.
--
Cheers,
Tink