You can use awk
as shown below, however, this is NOT a robust solution and will fail if the xml is not formatted correctly e.g. if there are multiple elements on the same line.
$ dt=$(awk -F '[<>]' '/IntrBkSttlmDt/{print $3}' file)
$ echo $dt
1967-08-13
I suggest you use a proper xml processing tool, like xmllint
.
$ dt=$(xmllint --shell file <<< "cat //IntrBkSttlmDt/text()" | grep -v "^/ >")
$ echo $dt
1967-08-13
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…