3

Can I use seq to go from 001 to 999?

Anthon
  • 78,313
  • 42
  • 165
  • 222
JoeS
  • 141
  • 1
  • 4
  • 3
    The answer is in [the man page](http://man.cx/seq) – glenn jackman Aug 29 '14 at 19:28
  • 1
    How is this question - which is specifically about the command `seq` - a duplicate of a question specifically about `bash` brace expansion? The two are not the same. – mikeserv Aug 30 '14 at 02:57

2 Answers2

9

Yes using the -w parameter:

-w, --equal-width
          equalize width by padding with leading zeroes

e.g.

seq -w 0 999

gives

000
001
...
999
Renan
  • 16,976
  • 8
  • 69
  • 88
3

This will work in any shell on a machine that has coreutils installed:

seq -w 1 10 and seq -w 1 100

Source: https://stackoverflow.com/questions/11891162/bash-sequence-00-01-10

Jan
  • 7,600
  • 2
  • 34
  • 41