hex2dat
442 Bytes
#!/bin/sh
if [ "$1" = "" -o "$2" = "" ]; then
echo "Usage hexfile datfile"
exit
fi
rm -rf $2
for i in `cat $1`
do
c1=`echo "print 0x${i} >> 24" | perl`
c4=`echo "print 0x${i} >> 16" | perl`
c2=`echo "print ${c4} & 0xff" | perl`
c4=`echo "print 0x${i} >> 8" | perl`
c3=`echo "print ${c4} & 0xff" | perl`
c4=`echo "print 0x${i} & 0xff" | perl`
echo "printf \"%c%c%c%c\", $c1,$c2,$c3,$c4" | perl >>$2
done