Using seq to zero-pad strings in a series

I thought this was pretty cool:


for i in `seq -f "%03g" 1 100`; do wget http://www.gozerog.com/images/Hawking_$i.jpg; done

We were trying to do this the other night using bash, but to no avail since the square brackets only work for local file path expansion. I should have remembered seq. Also, this example shows how to 0-pad a series using seq and bash, noted by the *-f* option. Three cheers for seq!



Comments

  1. Josh

    May 19, 2007 at 8:06 AM

    :) Good work! Easy and nice