#!/bin/sh
#
# Remove colour skew from Hugin project files
# $Id: discolour,v 1.1 2018/07/21 01:33:00 grog Exp $
# Usage:
# discolour [pto files]
# Default is to apply to all files ending in .pto
FILES=$*
if [ "$FILES" = "" ]; then
  FILES=*.pto
fi
if [ "$FILES" = "" ]; then
  espeak "No project files found"
  echo "No project files found"
  exit 1
fi
for i in $FILES; do
    sed < $i > $i.$$ 's:^\(i.*Er\)[.0-9]* Eb[.0-9]*\(.*\):\11 Eb1\2:'
    if [ $? -eq 0 ]; then
      mv $i.$$ $i
    else
	echo Fail $?
    fi
done
