#!/bin/sh # build_nvds # # David Adams # October 2003 # For DIAL 0.60 # # Builds an event merged dataset from a list of ID's. # E.g.: build_nvds DSNAME # # Input: $1 - dataset name DSNAME # idlists/DSNAME.ids - list of ID's # Output: nvds_DSNAME.xml - merged dataset if [ "$1" = "-h" -o -z "$1" ]; then echo "Usage: $0 DSNAME" exit 0 fi DSNAME=$1 NVDS=nvds_$DSNAME.xml IDDIR=idlists IDLIST=$IDDIR/$DSNAME.ids # Make sure input file exists if [ ! -r $IDLIST ]; then echo Unable to read input file $IDLIST exit 1 fi # No action if output file already exists. if [ -r $NVDS ]; then echo Nonvirtual dataset already exists: echo " $NVDS" echo "Please delete before recreating" fi # Count the lines in the file. ALL=`cat $IDLIST` FIRST=`echo $ALL | sed 's/ .*//'` if [ -z "$FIRST" ]; then echo Inputfile is empty echo $IDLIST exit 2 fi MANY= if [ "$ALL" != $FIRST ]; then MANY=true fi # Merge datasets if [ -n "$MANY" ]; then echo "Merging..." dataset_merge_events -u -f $NVDS -l $IDLIST STAT=$? if [ $STAT != 0 ]; then echo Error $STAT exit 3 fi # If there is only one sub-dataset, then just copy the file. else echo "No merge; there is only one partition" cp $FIRST $NVDS fi echo Non-virtual dataset written to $NVDS