#!/bin/bash # shell script to aid in the creation of a configuration file # for make_ssc if [ $# -lt 1 ]; then echo "Usage $0 -i [-t table (OBJECTS)] [-c channel (ALL)] [-m merge (AVE_REG)]" exit fi # set default values for the input channel, the # kind of merging and the objects table name: CHAN=ALL MERGE=AVE_REG TABLE=OBJECTS # read command line arguments: GoOn=0 while [ $GoOn = 0 ] do case $1 in -c) CHAN=${2} shift shift ;; -i) CAT=${2} shift shift ;; -m) MERGE=${2} shift shift ;; -t) TABLE=${2} shift shift ;; *) GoOn=1 ;; esac done # create the config file by grepping and awking the output of ldacdesc. # The result is written to STDOUT: ldacdesc -q -i ${CAT} -t ${TABLE} | grep "Key name" | \ grep -v FIELD_POS | grep -v SeqNr | grep -v NUMBER |\ awk -F. '{printf("COL_NAME=%s\nCOL_INPUT=%s\nCOL_CHAN=%s\nCOL_MERGE=%s\n#\n",$NF,$NF,CHAN,MERGE)}' CHAN=$CHAN MERGE=$MERGE