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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In