#!/bin/bash InputTrainFile=$1 InputTestFile=$2 Pred=$3 Neighborhood=$4 LOCOMOTrainFile="fastLOCOMO_Train" LOCOMOTestFile="fastLOCOMO_Test" #There should be at least the last two attributes (KLOC and ActualEffort) in the training and testing file. Otherwise LC is meaningless. numberOfAttributesVar=`./attributes $InputTrainFile` if [ $numberOfAttributesVar -lt 2 ] then exit; fi #building the train file based on the format required gawk 'BEGIN {FS=OFS=","} /@/ {next} {print $0}' $InputTrainFile > $LOCOMOTrainFile; gawk 'BEGIN {FS=OFS=","} /@/ {next} {print $0}' $InputTestFile > $LOCOMOTestFile; cat $LOCOMOTestFile | while read instance do echo $instance > $LOCOMOTestFile.instance; gawk -f staticLocomo_near.awk Neighborhood=$Neighborhood Pass=1 $LOCOMOTestFile.instance Pass=2 $LOCOMOTrainFile Pass=3 $LOCOMOTrainFile > $LOCOMOTrainFile.nearest RandomNumber=$RANDOM gawk -f staticLocomo_lc.awk Skip=0 Seed=$RandomNumber Pred=$Pred Pass=1 $LOCOMOTrainFile.nearest Pass=2 $LOCOMOTestFile.instance; done