#!/bin/bash
if [[ $# -lt 2 ]]
then
	echo " Usage : $0 <SCR_FILE> <DEST_FILE>"
	exit
fi
if [[ ! -f $1 ]]
then
	echo " FILE $1 Does not exist!"
	exit
fi
if [[ -f $2 ]]
then
	echo -n " FILE $2 already exists. Overwrite ? Yes/No --> "
	read answer
	if [[ $answer != "Yes" ]]
	then
		exit
	fi
	cp /dev/null $2
fi
while read -r addr;
do
    x=$(expr substr $addr 1 8)
	y=$(expr substr $addr 9 8)
	z=$(expr substr $addr 17 8)
	t=$(expr substr $addr 25 8)
  	echo "$((2#$x)).$((2#$y)).$((2#$z)).$((2#$t))" >> $2
done < $1
exit