Adding Leading Zero in Bash
Francisco Borges
f.borges at rug.nl
Mon Oct 23 14:27:53 UTC 2006
? On Sun, Oct 22, 2006 at 01:56PM +0300, OOzy Pal wrote:
> How can I add a leading zero to numbers that are from 1 to 9 to be 01,
> 02. . .,09?
I just read *very fast* the other answers to this question.
Ignore them all. ;-)
[...]
Use seq:
seq FIRST INCREMENT LAST
# equalize width by padding with leading zeroes
seq -w 1 1 10
Or this:
seq --format="%02.f" 1 1 9
BTW, "seq" works with floats as well.
cheers,
--
Francisco
More information about the ubuntu-users
mailing list