Note that there are some explanatory texts on larger screens.

plurals
  1. POneed awk script for some xml node concat
    text
    copied!<p>i'm new to awk and need some assistance with a simple awk script to strip all the character metrics and concat the attributes to squash the XML by quite a bit.</p> <p>input</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;document&gt; &lt;page&gt; &lt;block bbox="270 163.717 363.262 224.155"&gt; &lt;line bbox="270 163.717 274.453 182.669"&gt; &lt;span bbox="270 163.717 274.453 182.669" font="Helvetica-Bold" size="16.02"&gt; &lt;char bbox="270 200.519 284.425 224.155" c="f"/&gt; &lt;char bbox="284.43 200.519 291.082 224.155" c="o"/&gt; &lt;char bbox="291.087 200.519 297.74 224.155" c="o"/&gt; &lt;/span&gt; &lt;/line&gt; &lt;line bbox="270 200.519 363.262 224.155"&gt; &lt;span bbox="270 200.519 363.262 224.155" font="Helvetica-Bold" size="19.98"&gt; &lt;char bbox="270 200.519 284.425 224.155" c="b"/&gt; &lt;char bbox="284.43 200.519 291.082 224.155" c="a"/&gt; &lt;char bbox="291.087 200.519 297.74 224.155" c="r"/&gt; &lt;/span&gt; &lt;/line&gt; &lt;/block&gt; &lt;/page&gt; &lt;/document&gt; </code></pre> <p>desired output</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;document&gt; &lt;page&gt; &lt;block bbox="270 163.717 363.262 224.155"&gt; &lt;line bbox="270 163.717 274.453 182.669"&gt; &lt;span bbox="270 163.717 274.453 182.669" font="Helvetica-Bold" size="16.02"&gt;foo&lt;/span&gt; &lt;/line&gt; &lt;line bbox="270 200.519 363.262 224.155"&gt; &lt;span bbox="270 200.519 363.262 224.155" font="Helvetica-Bold" size="19.98"&gt;bar&lt;/span&gt; &lt;/line&gt; &lt;/block&gt; &lt;/page&gt; &lt;/document&gt; </code></pre> <p>thanks!</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