說我有下面的XML提取標籤:在shell腳本的另一個標籤相同級別的
<app-deployment>
<name>gr1</name>
<target>AdminServer</target>
<module-type>ear</module-type>
<source-path>/u01/app/wls1035_homes/wls1035_9999/grc864</source-path>
<security-dd-model>DDOnly</security-dd-model>
<staging-mode>stage</staging-mode>
</app-deployment>
<app-deployment>
<name>gr2</name>
<target>AdminServer</target>
<module-type>ear</module-type>
<source-path>/u01/app/wls1035_homes/wls1035_9999/grc864</source-path>
<security-dd-model>DDOnly</security-dd-model>
<staging-mode>nostage</staging-mode>
</app-deployment>
<app-deployment>
<name>gr3</name>
<target>AdminServer</target>
<module-type>ear</module-type>
<source-path>/u01/app/wls1035_homes/wls1035_9999/grc864</source-path>
<security-dd-model>DDOnly</security-dd-model>
</app-deployment>
我怎樣才能提取分期模式變量的值,說名爲應用程序部署GR2?
沒有perl的解決方案請,因爲我是侷限於只用shell腳本解決方案,如用sed,awk中,等 – Codrguy 2012-02-13 23:24:27
和您的XML將始終作爲完全格式化如上你的樣品? – shellter 2012-02-13 23:56:30
是的,它是由另一個腳本生成的xml,所以格式將永遠是相同的 – Codrguy 2012-02-14 00:08:28