shell如何解析xml
<?xml version="1.0" encoding="ISO-8859-1"?> <properties port="10000" URI="tcp://localhost" />
怎么把port的值解析出来
sed '/port=/!d; s/.*port="\([0-9]\+\)".*/\1/' urfile
cat file.xml | grep "port=" | awk -F "\"" '{print $2}' file.xml里面的内容就是 <?xml version="1.0" encoding="ISO-8859-1"?> <properties port="10000" URI="tcp://localhost" />
|