#!/bin/bash

for file in ./*.xls
do
	echo "${file}"
	md5=`md5sum "${file}" | cut -d' ' -f 1`
	echo "${md5}"
	newfile=`sed -n "4p" "${file}" | sed -e "s/\t/^/g" | cut -d"^" -f 4 | cut -d" " -f 1 | sed -e "s/-//g"`
	mv "${file}" "${newfile}.${md5}.xls"
done

