[3325] in testers

home help back first fref pref prev next nref lref last post

sparc 8.1.7: awk printf() doesn't like variable field widths

daemon@ATHENA.MIT.EDU (John Hawkinson)
Wed Jul 16 09:37:54 1997

Date: Wed, 16 Jul 1997 09:37:41 -0400
To: testers@MIT.EDU
From: John Hawkinson <jhawk@MIT.EDU>

Yet another bug in the Solaris 2.5.1 awk:

[mary-kay-commandos!jhawk] /var/log> which awk nawk
/usr/bin/awk
/usr/bin/nawk
[mary-kay-commandos!jhawk] /var/log> lptest 2 4 | awk '{printf "%*d\n", NR, NR}' 
2
 2
  2
   2
[mary-kay-commandos!jhawk] /var/log> lptest 2 4 | /usr/xpg4/bin/awk '{printf "%*d\n", NR, NR}'
1
 2
  3
   4
[mary-kay-commandos!jhawk] /var/log> lptest 2 4 | nawk '{printf "%*d\n", NR, NR}'
1
 2
  3
   4

The man page indicates it uses printf(3s) format strings, which include
variable field widths, but it doesn't seem to work.

nawk and /usr/xpg4/bin/awk seem to work fine.

--jhawk

home help back first fref pref prev next nref lref last post