Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sprintf question - order AND padding 1

Status
Not open for further replies.

Xaqte

IS-IT--Management
Oct 4, 2002
971
0
0
US
I know how to use sprintf for padding: %02d
And I know how to use if for the argument position: %2$d


But, I cannot figure out how to combine the two.

How would I padd it AND specify the argument position?

Any thoughts/suggestions would be greatly appreciated?

X
 
Is this what you mean?

printf '%2$02d %1$02d', 12, 34

prints 0034 0012

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Brilliant!

Thanks Kevin!
 
Hardly brilliant, but thanks. The sprintf documentation has an example of the usage.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top