# style: what i like (my latest first two attempts) perl -e"printf('%4s: %s',++$a,$_)while(<>)" file perl -e"printf'%4s: %s',++$a,$_ while<>" file # then i did a lot of searching, and ran accross clemburg's solution # (which was 'broken' like the craft version, see end) perl -pe "s/^/++$i.' 'x4/e" file # then i remembered -p and broke it down to ### which is by far my favorite (the one i use) perl -pe "printf'%4s: ',++$a" file # style: merlyn (as featured in WebTechniques) perl -pe"printf'%6s ','='.++$a.'='" file # or more acurately perl -pe"printf'%-6s ','='.++$a.'='" file # or most accurately (since his output looks like' =2= code') perl -pe"printf'%8s%-8s ','','='.++$a.'='" file # style: [craft] (craft doesn't handle 3digits well) # you can always change the 2 into 3 to handle 3 digit nums perl -pe"printf'%-2s: ',++$a" file