#!/bin/sh for f in */[0-9]*.pl do N=`cat $f | grep '#END' | cut -d- -f3 | tr -d '[ \t\n\r]'` if [ -z "$N" ]; then echo "$f had no standard name in it" continue; fi D=`dirname "$f"` if [ ! -r "$D/$N.pl" ]; then echo "$f -> $D/${N}.pl" mv $f "$D/${N}.pl" fi done