Home > Using seq to zero-pad strings in a series

Using seq to zero-pad strings in a series

May 19th, 2007

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!


, ,

  1. May 19th, 2007 at 08:06 | #1

    :) Good work! Easy and nice

  1. No trackbacks yet.
Comments are closed.