30 lines
557 B
Bash
30 lines
557 B
Bash
#!/bin/bash
|
|
if [[ $# -lt 2 ]]
|
|
then
|
|
echo "Usage: $0 <SRC_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 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 |