Tuesday 24 March 2009

Bash number formatting

Use printf as in c. For zero padding add a 0 infront of the field length, eg: %06i

So to delete more files than rm can handle

for i in `seq 0 100`; do file=`printf "%06i" "$i"`; echo $file; done

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete