awk -F "[F][0-9]" ' {ORS=""} { print "mv " $0 " " "\""tolower($1) "f0"} {if (2>length($2)) print "0"} {ORS="\n"} {print $2 "\""}'
input:
REF01
REF010
REF02
REF03
REF04
REF05
REF06
REF07
REF08
REF09
output
mv REF01 "ref001"
mv REF010 "ref010"
mv REF02 "ref002"
mv REF03 "ref003"
mv REF04 "ref004"
mv REF05 "ref005"
mv REF06 "ref006"
mv REF07 "ref007"
mv REF08 "ref008"
mv REF09 "ref009"
Жду конструктивной критики.