

prefix=$2;
suffix=$1;

for i in *; do

    old=$i;

    if test -n "${prefix}"; then
        prefix_old=$(echo $old | cut -d${prefix} -f1)${prefix};
        old=$(echo $old | cut -d${prefix} -f2);
    fi;
    if test -n "${suffix}"; then
        suffix_old=${suffix}$(echo $old | cut -d${suffix} -f2);
        old=$(echo $old | cut -d${suffix} -f1);
    fi;

    x=$(echo $old | cut -d_ -f1 | tr -d x);
    w=$(echo $old | cut -d_ -f2 | tr -d w);
    n=$(echo $old | cut -d_ -f3);
    new=x0${x}_w0${w}_0${n};

    echo "${i} : ${old} -> ${new}";

    file_new=${prefix_old}${new}${suffix_old};

    sed s/${old}/${new}/ ${i} > ${file_new};
#    svn rm ${i};
done;