说我有下面的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