#!/bin/bash/ #The following files must be in the same directory as the QRDA files being processed: #MeasuresAndReportingParametersWithVariables.xml #MEASURES-BY-PATIENT.txt #This script which is FixMeasuresSection.sh for MyFile in $(ls -1 PAT_*_QRDA_V1_0_0-11-10-2010_16.xml); do StructuredBodyLine=$(grep -n " tag is added in the Header/Parameter document to anchor the replacement. IT will be deleted when the section is put into the file echo "a is $a start line to delete for /
pairs" echo "b is $b end line to delete" echo "$MyFile" #We can either put this next line in after the fact or before. Currently it is before #sed -in '/structuredBody/{ s/$/\n/ }' "$MyFile" #sed -in "$c"s///p "$MyFile" #MS=$(cat MeasuresAndReportingParametersWithVariables.xml) sed -in "$a","$b"d "$MyFile" #insert the contents of this file after the structured body line sed -in '/MeasuresSection/r MeasuresAndReportingParametersWithVariables2011.xml' "$MyFile" sed -in s/\// "$MyFile" done rm -rf PAT*.xmln NewFunction() { File="PAT_$1_QRDA_V1_0_0-11-10-2010_16.xml" shift while [ "0" != "$#" ] do echo "Now I am in the function" echo "$File" echo "$1" sed -in "s///" "$File" sed -in "s/@@@@$1-item@@@@-->//" "$File" sed -in "s/@@@@$1-Act@@@@-->//" "$File" sed -in "s/@@@@M-Set2011@@@@-->//" "$File" sed -in "s///" "$File" shift done } while read Line ; do echo "$Line" NewFunction $Line done < "MEASURES-BY-PATIENT.txt" rm -rf PAT*.xmln