count is a minimalist perl script in the spirit of seq(1) but with a simpler syntax. It only counts in increments of 1, but -on the other hand- it knows how to count down.
#!/usr/bin/perl use strict; my($from,$to,$fmt,$inc)=@ARGV; $to||=$from; $fmt||="%d"; print join("\n",map{sprintf("$fmt",$_)}($from>$to?reverse($to..$from):($from..$to))),"\n";
(Download)
For instance, “count 10 1 %03d” will count down from 10 to 0 padding with zeroes to three digits. “count 0 15 %x” will count in hex. If you omit the format string it will default to “%d” (decimal, no padding).
count is very useful -among other things- for file leeching:
$ for i in `count 1 10 %02d`; do wget http://..../file-$i.pdf; done