Joined: Tue Jan 18, 2011 6:18 am Posts: 14
|
Hi,
I have a simple problem. I have a script that is trying to place a variable inside a XML tag but it's being ignored. I am querying a web page that outputs xml and am trying to get the value between certain tags.
URL to query: "https://www.somesite.tld/monitor.asp?cmd=getNoOfSuccessfulTransactionsVendor&dur=300&vendor=somecustomer"
Result: <?xml version="1.0" encoding="ISO-8859-1" ?> - <vspaccess> <errorcode>0000</errorcode> <nooftransctions>55</nooftransctions> <timestamp>21/02/2011 13:23:10</timestamp> </vspaccess>
So in the example above I want the value of 55 only.
Here's my script: ___________ #!/bin/bash
LYNX=`which lynx` SED=`which sed` URL="https://www.somesite.tld/monitor.asp" CMD=$1 DUR=$2 VENDOR=$3 TAG=$4
# $LYNX -source "$URL?cmd=$CMD&dur=$DUR&vendor=$VENDOR" | $SED 's%.*<$TAG>\(.*\)</$TAG>.*%\1%p' _______________
So I run: ./XMLData getNoOfSuccessfulTransactionsVendor 300 somecustomer nooftransctions
Unfortunately the $TAG variable is not being read correctly and I'm assuming it's because it's between ''
Any help please?
|
|