ファイルの名前を A0 A1 A2 A3 から A001 A002 A003 に変更する方法 次のような名前変更コードがあります。
n=$(ls -1 | grep '^A' -c) # find the number for A files
nfiles=$(ls -1 *.obj| grep -v '^A'); # list of all non-A files
for file in $nfiles; # for each of the non-A files
do
n=$(($n+1));
new_file=A$n.obj # new name with next available A file name
mv $file $new_file # rename with new file name
done