please help me figure out what I am doing wrong.
I have this file called "res.xml"
<sequence type="a"> <transaction> <branchSerial>1</branchSerial> <postingDate>2021-08-02</postingDate> <postingTime>2021-08-06 19:42:49 UTC</postingTime> <step type="a"> <record type="c" label="deviceRecord"> <operation option="V">View</operation> <tableName>DEVICE</tableName> <tableDescription>Device</tableDescription> <rowDescription>[email protected]</rowDescription> </record> </step> </transaction> </sequence>
I am trying to pull the postingDate and put into a variable. My script:
#!/bin/ksh dbDATE=$(sed -n -e "s/<postingDate>\([0-9]*\)<\/postingDate>/\1/p" res.xml) echo "current DB date: $dbDATE"
when I run it, I get nothing, just blank.
It is very odd because I have used the same logic elsewhere without problems. Can anybody see what I am missing???
Thank you so much for any help you can provide
[0-9-]*
xmlstarlet sel -t -v '//postingDate' dateRes.xml