Hi,
I a sequance number from 1-999 and i want asing the value like 001,002..999
Exp:
file_001
file_002
file_003...
file_999
How can i disaplay the sequnace number as mention above.
Hi,
I a sequance number from 1-999 and i want asing the value like 001,002..999
Exp:
file_001
file_002
file_003...
file_999
How can i disaplay the sequnace number as mention above.
echo ""| awk '{ for(i=1;i<=999;i++) printf "file_%.3d\n",i }'
panyam solution works. here I want to mention zsh.
if you have zsh, with
setopt BRACE_CCL
your requirement can be as easy as:
kent$ echo file_{001..100}
output would be:
file_001 file_002 file_003 file_004 file_005 file_006 file_007
...
file_040 file_041 file_042 file_043....
file_099 file_100
If you have the seq command:
seq 1 10|xargs -I '{}' printf "file_%03d%s\n" {}
Most modern shells also do brace expansion, but it's not a part of POSIX:
echo {1..10}|xargs -n1|xargs -I '{}' printf "file_%03d%s\n" {}