日期:2014-05-16 浏览次数:20634 次
<server> <name>120</name> <IP>10.166.47.33</IP> </server> <client> <name>134</name> <IP>23.44.22.33</IP> </client>
[liangdong@bb-browser-test00.vm.baidu.com sh_project]$ ./main.sh 120 [liangdong@bb-browser-test00.vm.baidu.com sh_project]$ cat main.sh #!/bin/bash content=`awk '{str=str$0}END{print str}' a` echo $content | egrep -o '<server>.*<name>.*</name>.*</server>' | egrep -o '<name>.*</name>' | sed -r 's/<\/?name>//g'