XMLを解析するための簡単なbashスクリプトを書いています。私はsedとawkを使用していましたが、xmllintの方が適していると思います。
残念ながら、私は xpath にまったく慣れていないので、本当に戦っています。
次のxmlを取得しようとしています:
<?xml version="1.0" encoding="UTF-8"?>
<releaseNote>
<name>APPLICATION_ercc2</name>
<change>
<date hour="11" day="10" second="21" year="2013" month="0" minute="47"/>
<submitter>Automatically Generated</submitter>
<description>ReleaseNote Created</description>
</change>
<change>
<version>2</version>
<date hour="11" day="10" second="25" year="2013" month="1" minute="47"/>
<submitter>fred.bloggs</submitter>
<description> first version</description>
<install/>
</change>
<change>
<version>3</version>
<date hour="12" day="10" second="34" year="2013" month="1" minute="2"/>
<submitter>fred.bloggs</submitter>
<description> tweaks</description>
<install/>
</change>
<change>
<version>4</version>
<date hour="15" day="10" second="52" year="2013" month="1" minute="38"/>
<submitter>fred.bloggs</submitter>
<description> fixed missing image, dummy user, etc</description>
<install/>
</change>
<change>
<version>5</version>
<date hour="17" day="10" second="31" year="2013" month="1" minute="40"/>
<submitter>fred.bloggs</submitter>
<description> fixed auth filter and added multi opco stuff</description>
<install/>
</change>
.....
それを処理して変数として '3' を xpath スクリプトに渡し、次のように出力します。
4 fred.bloggs 10/1/2013 15:38 fixed missing image, dummy user, etc
5 fred.bloggs 10/1/2013 17:40 fixed auth filter and added multi opco stuff
つまり、各ノードのコンテンツの複雑な組み合わせで、バージョンの値がたとえば 3 より大きい場合です。