#! /bin/sh
# Automatically rename performances according to the performance name field
for i
do
	PN=`vpr -n $i`
	if [ "$?" != "0" ] ; then
		echo "vpr -n $i failed.  Skipping $i..."
		continue
	fi
	PN=`echo $PN | map 0=3:12 -t | tr ' ' '_'`
	NAME=`echo $PN | tr "'"'\&\!\$\|\`\*\"\/\<\>\(\)\{\}\[\]\\' ' '`
	echo -n "$i -> P.$NAME"
	if [ -s P.$NAME ] ; then
		echo "   P.$NAME exists.  skipping $i..."
	else
		mv $i P.$NAME
		echo ""
	fi
done
