for x in `ls *.dat`
do
fileName=${x}
echo "$fileName"
case ${x} in (*.dat)
cat ${x}|sed 's/^[LINEDT]*//' $fileName > temp
mv temp ${x}
line=`wc -l ${x}|awk '{print $1}'`
echo $line
echo $fileName
echo ${x}
cat ${x}|sed $line'd' $fileName >temp
mv temp ${x}
cat ${x}|sed '1d' $fileName >temp
mv temp ${x}
esac
done
do
fileName=${x}
echo "$fileName"
case ${x} in (*.dat)
cat ${x}|sed 's/^[LINEDT]*//' $fileName > temp
mv temp ${x}
line=`wc -l ${x}|awk '{print $1}'`
echo $line
echo $fileName
echo ${x}
cat ${x}|sed $line'd' $fileName >temp
mv temp ${x}
cat ${x}|sed '1d' $fileName >temp
mv temp ${x}
esac
done