#!/bin/sh

# cat pick_ew.sta | grep -v -E "^[ ]*#" | sed -e "s/ [ ]*/ /g" | cut -f 24 -d ' ' 

# Check variable EW_PARAMS
if [ -z "${EW_PARAMS}" ]; then
    echo "Error: EW_PARAMS is not defined!"
    exit
fi

FILEPICKEWSTA=${EW_PARAMS}/pick_ew.sta

# TODO Path for binaries
MYSQL_FORMAT=/Users/mtheo/Desktop/cvswork/bees/soft/mysql_format/src/mysql_format

grep -v -E "^#.*|^[ ]*$" ${FILEPICKEWSTA} | sed \
						-e "s/#.*$//g" \
						-e "s/^ [ ]*//g" \
						-e "s/ [ ]*$//g" \
						-e "s/ [ ]*/, /g" \
						-e "s/\([A-Za-z][A-Za-z0-9]*\)/'\1'/g" \
						-e "s/--/'--'/g" \
						-e "s/^/CALL sp_insert_pick_ew (/" \
						-e "s/$/);/"

exit



