From unknown Fri Aug 15 17:21:13 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10782: zero padding does not work in case of strings Resent-From: Praveen A Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 10 Feb 2012 18:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10782 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 10782@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13289000288679 (code B ref -1); Fri, 10 Feb 2012 18:54:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Feb 2012 18:53:48 +0000 Received: from localhost ([127.0.0.1]:35236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvvbP-0002Fw-89 for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:53:47 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46687) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvvbN-0002Fj-8V for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:53:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvvZz-0000gP-VY for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:52:25 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,BODY_8BITS, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:49597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvvZz-0000gF-U0 for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:52:19 -0500 Received: from eggs.gnu.org ([140.186.70.92]:60687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvvZv-0006sV-Rw for bug-coreutils@gnu.org; Fri, 10 Feb 2012 13:52:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvvZu-0000X3-Qm for bug-coreutils@gnu.org; Fri, 10 Feb 2012 13:52:15 -0500 Received: from mail-vw0-f41.google.com ([209.85.212.41]:41926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvvZu-0000Vz-OR for bug-coreutils@gnu.org; Fri, 10 Feb 2012 13:52:14 -0500 Received: by vbip1 with SMTP id p1so2551932vbi.0 for ; Fri, 10 Feb 2012 10:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hizecHWyIRKo5V9fbaTEVbseZzogtwRBqOnvcGDo7lc=; b=BqIow1lzwZnVVTWgS/6/MSkhHjzeAgaDa1vEVKjNJmffwnE+tG/8ENrdoZgPFLPTLj isYRKARhWVbpXhWMwRcM+olhpZZsVVIdAbFh16NXhyrL4T2985S0jkFOkbAVLiFVUyAT vjly4pTlnfbs4iqTXAW0/zDPuY654TcFMYkn8= MIME-Version: 1.0 Received: by 10.52.173.230 with SMTP id bn6mr3598958vdc.19.1328899933799; Fri, 10 Feb 2012 10:52:13 -0800 (PST) Received: by 10.220.205.197 with HTTP; Fri, 10 Feb 2012 10:52:13 -0800 (PST) Date: Sat, 11 Feb 2012 00:22:13 +0530 Message-ID: From: Praveen A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) $ printf %04d 12 0012$ printf %4d 12 12$ printf %04s 12 12$ printf %4s 12 12$ It would be very useful if it works for strings too (I found this when trying to zero pad hex values in an ipv6 address). Now it requires an additional sed find and replace to get the desired result. Thanks Praveen --=20 =E0=B4=AA=E0=B5=8D=E0=B4=B0=E0=B4=B5=E0=B5=80=E0=B4=A3=E0=B5=8D=E2=80=8D = =E0=B4=85=E0=B4=B0=E0=B4=BF=E0=B4=AE=E0=B5=8D=E0=B4=AA=E0=B5=8D=E0=B4=B0=E0= =B4=A4=E0=B5=8D=E0=B4=A4=E0=B5=8A=E0=B4=9F=E0=B4=BF=E0=B4=AF=E0=B4=BF=E0=B4= =B2=E0=B5=8D=E2=80=8D You have to keep reminding your government that you don't get your rights from them; you give them permission to rule, only so long as they follow the rules: laws and constitution. From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 14:31:32 2012 Received: (at control) by debbugs.gnu.org; 10 Feb 2012 19:31:32 +0000 Received: from localhost ([127.0.0.1]:35255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvwBq-00038V-NQ for submit@debbugs.gnu.org; Fri, 10 Feb 2012 14:31:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62024) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvwBf-000384-G0; Fri, 10 Feb 2012 14:31:20 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1AJTsCC001083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Feb 2012 14:29:54 -0500 Received: from [10.3.113.115] (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1AJTsst026361; Fri, 10 Feb 2012 14:29:54 -0500 Message-ID: <4F357031.10309@redhat.com> Date: Fri, 10 Feb 2012 12:29:53 -0700 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Praveen A Subject: Re: bug#10782: zero padding does not work in case of strings References: In-Reply-To: X-Enigmail-Version: 1.3.5 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBD6438615BC6B186D8976513" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control Cc: 10782-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBD6438615BC6B186D8976513 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable tag 10782 notabug thanks On 02/10/2012 11:52 AM, Praveen A wrote: > $ printf %04d 12 > 0012$ printf %4d 12 > 12$ printf %04s 12 > 12$ printf %4s 12 > 12$ Thanks for the report. In printf(3), POSIX states the use of the 0 modifier with %s is undefined: http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html "0 For d , i , o , u , x , X , a , A , e , E , f , F , g , and G conversion specifiers.... For other conversions, the behavior is undefine= d." Note that glibc silently ignores %04x, and gcc correctly warns about it being fishy: $ cat foo.c #include int main() { printf("%04s\n", "hi"); return 0; } $ gcc -o foo foo.c -Wall foo.c: In function =E2=80=98main=E2=80=99: foo.c:2:1: warning: '0' flag used with =E2=80=98%s=E2=80=99 gnu_printf fo= rmat [-Wformat] $ ./foo hi >=20 > It would be very useful if it works for strings too (I found this when > trying to zero pad hex values in an ipv6 address). Now it requires an > additional sed find and replace to get the desired result. Note that you didn't even test coreutils - you tested the built-in printf of your shell. Coreutils intentionally errors out on this undefined behavior, to make it obvious that there is no sane documented way to implement it: $ /usr/bin/printf %04s 12 /usr/bin/printf: %04s: invalid conversion specification Implementing %04s in coreutils, but not also in glibc, bash, dash, ksh, and so forth, all at the same time, would just cause user confusion due to the inconsistencies; plus, you would have to wait for those fixes to propagate into your machine before you could rely on it. Rather, you should patch your script to use %d or %x or other tricks in a manner that works today: # Use $(()) to convert hex to decimal, then 0-pad it back out to hex $ printf %04x $((0x12)) 0012 # given an arbitrary string in $1, add 0-padding if needed to extend # it to at least 4 characters $ f() { case ${#1} in 0|1|2|3) printf %0$((4-${#1}))d%s 0 "$1" ;; *) printf %s "$1" ;; esac } $ f 12 0012 As such, I'm closing this bug report as something we won't change. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigBD6438615BC6B186D8976513 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPNXAxAAoJEKeha0olJ0NqXCgH/1IetTsCsRbQGjpwMoMuiTdW 9VqhE97I5eaybdEPsI1hSYXzEOpskNui6ikGzLDNUun0xqU1eajVbe+3M7DFaGxC EqZjg7VbEddgPBiPVfJRGwRUVVFrHmcyHyjmBjurhgXN2yTibSaSbncpCytaz7AR i79EHImu9j9Eq2xOrbFn7iOywiWqqoUIq8OIPCtgzvVP/sQCrTLUHZvbTmRS6VUS ntbVGIa2N6jZq8RLjQMhpKtx4kIwlq5DGxs6ihz5cKCqOAKnZYt0PT9IJi5JFt66 Rt1EzJ20HesSyL5px3qhejaUA8QQ0V9NwWk6u7a6L6qBIKDOmUSr7idxwH/nGSE= =tD32 -----END PGP SIGNATURE----- --------------enigBD6438615BC6B186D8976513-- From unknown Fri Aug 15 17:21:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Praveen A Subject: bug#10782: closed (Re: bug#10782: zero padding does not work in case of strings) Message-ID: References: <4F357031.10309@redhat.com> X-Gnu-PR-Message: they-closed 10782 X-Gnu-PR-Package: coreutils X-Gnu-PR-Keywords: notabug Reply-To: 10782@debbugs.gnu.org Date: Fri, 10 Feb 2012 19:32:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1328902323-12114-1" This is a multi-part message in MIME format... ------------=_1328902323-12114-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #10782: zero padding does not work in case of strings which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 10782@debbugs.gnu.org. --=20 10782: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D10782 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1328902323-12114-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 10782-done) by debbugs.gnu.org; 10 Feb 2012 19:31:26 +0000 Received: from localhost ([127.0.0.1]:35253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvwBm-00038O-Bd for submit@debbugs.gnu.org; Fri, 10 Feb 2012 14:31:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:62024) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvwBf-000384-G0; Fri, 10 Feb 2012 14:31:20 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1AJTsCC001083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Feb 2012 14:29:54 -0500 Received: from [10.3.113.115] (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q1AJTsst026361; Fri, 10 Feb 2012 14:29:54 -0500 Message-ID: <4F357031.10309@redhat.com> Date: Fri, 10 Feb 2012 12:29:53 -0700 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: Praveen A Subject: Re: bug#10782: zero padding does not work in case of strings References: In-Reply-To: X-Enigmail-Version: 1.3.5 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBD6438615BC6B186D8976513" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 10782-done Cc: 10782-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigBD6438615BC6B186D8976513 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable tag 10782 notabug thanks On 02/10/2012 11:52 AM, Praveen A wrote: > $ printf %04d 12 > 0012$ printf %4d 12 > 12$ printf %04s 12 > 12$ printf %4s 12 > 12$ Thanks for the report. In printf(3), POSIX states the use of the 0 modifier with %s is undefined: http://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html "0 For d , i , o , u , x , X , a , A , e , E , f , F , g , and G conversion specifiers.... For other conversions, the behavior is undefine= d." Note that glibc silently ignores %04x, and gcc correctly warns about it being fishy: $ cat foo.c #include int main() { printf("%04s\n", "hi"); return 0; } $ gcc -o foo foo.c -Wall foo.c: In function =E2=80=98main=E2=80=99: foo.c:2:1: warning: '0' flag used with =E2=80=98%s=E2=80=99 gnu_printf fo= rmat [-Wformat] $ ./foo hi >=20 > It would be very useful if it works for strings too (I found this when > trying to zero pad hex values in an ipv6 address). Now it requires an > additional sed find and replace to get the desired result. Note that you didn't even test coreutils - you tested the built-in printf of your shell. Coreutils intentionally errors out on this undefined behavior, to make it obvious that there is no sane documented way to implement it: $ /usr/bin/printf %04s 12 /usr/bin/printf: %04s: invalid conversion specification Implementing %04s in coreutils, but not also in glibc, bash, dash, ksh, and so forth, all at the same time, would just cause user confusion due to the inconsistencies; plus, you would have to wait for those fixes to propagate into your machine before you could rely on it. Rather, you should patch your script to use %d or %x or other tricks in a manner that works today: # Use $(()) to convert hex to decimal, then 0-pad it back out to hex $ printf %04x $((0x12)) 0012 # given an arbitrary string in $1, add 0-padding if needed to extend # it to at least 4 characters $ f() { case ${#1} in 0|1|2|3) printf %0$((4-${#1}))d%s 0 "$1" ;; *) printf %s "$1" ;; esac } $ f 12 0012 As such, I'm closing this bug report as something we won't change. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigBD6438615BC6B186D8976513 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJPNXAxAAoJEKeha0olJ0NqXCgH/1IetTsCsRbQGjpwMoMuiTdW 9VqhE97I5eaybdEPsI1hSYXzEOpskNui6ikGzLDNUun0xqU1eajVbe+3M7DFaGxC EqZjg7VbEddgPBiPVfJRGwRUVVFrHmcyHyjmBjurhgXN2yTibSaSbncpCytaz7AR i79EHImu9j9Eq2xOrbFn7iOywiWqqoUIq8OIPCtgzvVP/sQCrTLUHZvbTmRS6VUS ntbVGIa2N6jZq8RLjQMhpKtx4kIwlq5DGxs6ihz5cKCqOAKnZYt0PT9IJi5JFt66 Rt1EzJ20HesSyL5px3qhejaUA8QQ0V9NwWk6u7a6L6qBIKDOmUSr7idxwH/nGSE= =tD32 -----END PGP SIGNATURE----- --------------enigBD6438615BC6B186D8976513-- ------------=_1328902323-12114-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 10 Feb 2012 18:53:48 +0000 Received: from localhost ([127.0.0.1]:35236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvvbP-0002Fw-89 for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:53:47 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46687) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvvbN-0002Fj-8V for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:53:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvvZz-0000gP-VY for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:52:25 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,BODY_8BITS, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:49597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvvZz-0000gF-U0 for submit@debbugs.gnu.org; Fri, 10 Feb 2012 13:52:19 -0500 Received: from eggs.gnu.org ([140.186.70.92]:60687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvvZv-0006sV-Rw for bug-coreutils@gnu.org; Fri, 10 Feb 2012 13:52:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvvZu-0000X3-Qm for bug-coreutils@gnu.org; Fri, 10 Feb 2012 13:52:15 -0500 Received: from mail-vw0-f41.google.com ([209.85.212.41]:41926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvvZu-0000Vz-OR for bug-coreutils@gnu.org; Fri, 10 Feb 2012 13:52:14 -0500 Received: by vbip1 with SMTP id p1so2551932vbi.0 for ; Fri, 10 Feb 2012 10:52:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hizecHWyIRKo5V9fbaTEVbseZzogtwRBqOnvcGDo7lc=; b=BqIow1lzwZnVVTWgS/6/MSkhHjzeAgaDa1vEVKjNJmffwnE+tG/8ENrdoZgPFLPTLj isYRKARhWVbpXhWMwRcM+olhpZZsVVIdAbFh16NXhyrL4T2985S0jkFOkbAVLiFVUyAT vjly4pTlnfbs4iqTXAW0/zDPuY654TcFMYkn8= MIME-Version: 1.0 Received: by 10.52.173.230 with SMTP id bn6mr3598958vdc.19.1328899933799; Fri, 10 Feb 2012 10:52:13 -0800 (PST) Received: by 10.220.205.197 with HTTP; Fri, 10 Feb 2012 10:52:13 -0800 (PST) Date: Sat, 11 Feb 2012 00:22:13 +0530 Message-ID: Subject: zero padding does not work in case of strings From: Praveen A To: bug-coreutils@gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) $ printf %04d 12 0012$ printf %4d 12 12$ printf %04s 12 12$ printf %4s 12 12$ It would be very useful if it works for strings too (I found this when trying to zero pad hex values in an ipv6 address). Now it requires an additional sed find and replace to get the desired result. Thanks Praveen --=20 =E0=B4=AA=E0=B5=8D=E0=B4=B0=E0=B4=B5=E0=B5=80=E0=B4=A3=E0=B5=8D=E2=80=8D = =E0=B4=85=E0=B4=B0=E0=B4=BF=E0=B4=AE=E0=B5=8D=E0=B4=AA=E0=B5=8D=E0=B4=B0=E0= =B4=A4=E0=B5=8D=E0=B4=A4=E0=B5=8A=E0=B4=9F=E0=B4=BF=E0=B4=AF=E0=B4=BF=E0=B4= =B2=E0=B5=8D=E2=80=8D You have to keep reminding your government that you don't get your rights from them; you give them permission to rule, only so long as they follow the rules: laws and constitution. ------------=_1328902323-12114-1--