Lately I found myself trying to generate a video from a series of images generated by a program. Doesn't sound difficult, until you start running into a stupid issue: your 1000th frame will come before your 2nd frame!
Luckily there's a very easy fix for this problem, just add zero padding in a bash script. How?
for i in seq 1 10
; do echo $i; done
That will print all the numbers between 1 and 10. This one will do the same, with zero padding:
for i in `seq 1 10`; do printf "%02dn" $i; done
In reply to this post, Links 16/9/2011: Boeing Goes With Android, Oracle Splits MySQL | Techrights commented @ 2011-09-16T20:30:41.000+02:00:
[...] Zero padding for Bash scripts [...]
Original published here.