#!/bin/bash
#Author Martin Prudek

if [ $# -ne 1 ]; then
	echo "Data dir not specified. Quitting.";
	exit 1;
fi

mkdir -p "$1"/__offsets_diff;
for file in `ls "$1"/__abstimes/*.at`; do
	filename=`echo "${file}" | sed 's:.*/::'`;
	if [ ! -e "$1/__offsets_diff/${filename}.dat" ]; then
		. ./parse_name.sh "${filename}";
		cat ${file} | sed '/^#/ d' |\
			./comp_doffsets "${nm[sa]}" \
			> "$1/__offsets_diff/${filename}.dat";
	fi
done
