The output of AWK printf() function differ between RHEL5 and RHEL7.

Solution Verified - Updated -

Issue

  • The output of AWK printf() function differ between RHEL5 and RHEL7.

    In RHEL5

    $ echo 5 | awk '{ printf("%02s\n",$1) }'
    05
    $ echo 5 | awk '{ printf("%02d\n",$1) }'
    05
    

    In RHEL7

    $ echo 5 | awk '{ printf("%02s\n",$1) }'
    5
    $ echo 5 | awk '{ printf("%02d\n",$1) }'
    05
    
  • When was this behavior changed?

Environment

  • Red Hat Enterprise Linux
  • awk

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content