I am trying to use a line of output in an XML file as input in another new XML file for processing purposes via a shell script. Since I am a newbie though, I'm not sure how to do this since the data is different everytime. I am using this technique with static data right now:
echo -n "Running data test... "
cat datafile.xml | sed -e s/changethis/intothis/ > /tmp/$$.xml
export RESULT=`~/xml /tmp/$$.xml | grep "<Code>SUCCESS</Code>"`
if [ "$RESULT" != "" ]; then { echo passed } else { echo FAILED ; exit } fi
The XML file has the data I need stored between XML tags, so I know I could grep that line and output it to another file, and use that file to refer to for the input in the next test. That file would have < Number >here'sthedata< /Number > in that file. The trick would be to parse the data out, in effect removing the tags, storing that value in a variable, and then using sed to do a replace in the new input file like I am above. I'm just unsure how to go about parsing the data out.
Hope this wasn't confusing