Note that there are some explanatory texts on larger screens.

plurals
  1. POxml_grep get value of first instace
    text
    copied!<p>i use xml_grep to export text from xml documents.</p> <p>So i have an xml document like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;Mediainfo version="0.7.52"&gt; &lt;File&gt; &lt;track type="General"&gt; &lt;Complete_name&gt;grm.mov&lt;/Complete_name&gt; &lt;Format&gt;MPEG-4&lt;/Format&gt; &lt;Format_profile&gt;QuickTime&lt;/Format_profile&gt; &lt;Codec_ID&gt;qt &lt;/Codec_ID&gt; &lt;File_size&gt;10.1 MiB&lt;/File_size&gt; &lt;Duration&gt;3s 600ms&lt;/Duration&gt; &lt;Overall_bit_rate_mode&gt;Variable&lt;/Overall_bit_rate_mode&gt; &lt;Overall_bit_rate&gt;23.5 Mbps&lt;/Overall_bit_rate&gt; &lt;Encoded_date&gt;UTC 2012-08-01 09:33:54&lt;/Encoded_date&gt; &lt;Tagged_date&gt;UTC 2012-08-01 09:34:00&lt;/Tagged_date&gt; &lt;Writing_library&gt;Apple QuickTime&lt;/Writing_library&gt; &lt;TIM&gt;00:00:00:00&lt;/TIM&gt; &lt;TSC&gt;25&lt;/TSC&gt; &lt;TSZ&gt;1&lt;/TSZ&gt; &lt;/track&gt; &lt;track type="Video"&gt; &lt;ID&gt;1&lt;/ID&gt; &lt;Format&gt;JPEG&lt;/Format&gt; &lt;Codec_ID&gt;mjpa&lt;/Codec_ID&gt; &lt;Duration&gt;3s 600ms&lt;/Duration&gt; &lt;Bit_rate_mode&gt;Variable&lt;/Bit_rate_mode&gt; &lt;Bit_rate&gt;23.5 Mbps&lt;/Bit_rate&gt; &lt;Width&gt;1 920 pixels&lt;/Width&gt; &lt;Height&gt;1 080 pixels&lt;/Height&gt; &lt;Display_aspect_ratio&gt;16:9&lt;/Display_aspect_ratio&gt; &lt;Frame_rate_mode&gt;Constant&lt;/Frame_rate_mode&gt; &lt;Frame_rate&gt;25.000 fps&lt;/Frame_rate&gt; &lt;Scan_type&gt;Interlaced&lt;/Scan_type&gt; &lt;Scan_order&gt;Bottom Field First&lt;/Scan_order&gt; &lt;Compression_mode&gt;Lossy&lt;/Compression_mode&gt; &lt;Bits__Pixel_Frame_&gt;0.453&lt;/Bits__Pixel_Frame_&gt; &lt;Stream_size&gt;10.1 MiB (100%)&lt;/Stream_size&gt; &lt;Language&gt;English&lt;/Language&gt; &lt;Encoded_date&gt;UTC 2012-08-01 09:33:54&lt;/Encoded_date&gt; &lt;Tagged_date&gt;UTC 2012-08-01 09:34:00&lt;/Tagged_date&gt; &lt;/track&gt; &lt;track type="Menu"&gt; &lt;ID&gt;2&lt;/ID&gt; &lt;Language&gt;English&lt;/Language&gt; &lt;Encoded_date&gt;UTC 2012-08-01 09:34:00&lt;/Encoded_date&gt; &lt;Tagged_date&gt;UTC 2012-08-01 09:34:00&lt;/Tagged_date&gt; &lt;/track&gt; &lt;/File&gt; &lt;/Mediainfo&gt; </code></pre> <p>There are 2 elements named 'Duration'. One under <code>&lt;track type="General"&gt;</code> and the other under <code>&lt;track type="Video"&gt;</code>. How can i export each one separately ?</p> <pre><code>xml_grep 'Duration' </code></pre> <p>returns both elements. I know this is a noobish question but i couldn't figure it out.</p> <p>Thank you in advance. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload