I want to pad a column so it's 8 characters wide, and make integers left-aligned with at most one leading zero like this:
[00 ]
[01 ]
[07 ]
[11 ]
[14 ]
I know how to add the leading zeroes (printf("%02d\n", integer)) or the padding (printf("%-8d\n", integer)), but I don't know how to combine the two. Is there an easy way to achieve this?