{"id":683,"date":"2024-11-22T15:01:21","date_gmt":"2024-11-22T15:01:21","guid":{"rendered":"https:\/\/blogs.ua.es\/jpm33\/?p=683"},"modified":"2024-11-22T15:02:21","modified_gmt":"2024-11-22T15:02:21","slug":"extraer-atributo-de-una-etiqueta-xml-en-lote","status":"publish","type":"post","link":"https:\/\/blogs.ua.es\/jpm33\/2024\/11\/22\/extraer-atributo-de-una-etiqueta-xml-en-lote\/","title":{"rendered":"Extraer atributo de una etiqueta XML en lote"},"content":{"rendered":"\n<p>Tengo un directorio con ficheros XML, tienen etiquetas del tipo  <code>&lt;process id=\"...\" name=\"...\" ....&gt;<\/code> y necesito extraer todos los valores del atributo name, Con Bash es muy sencillo usando este comando:<br><br><code>grep -oP ']*name=\"[^\"]*\"' *.xml | sed -E 's\/.*name=\"([^\"]*)\".*\/\\1\/'<\/code><\/p>\n\n\n\n<p>As\u00ed obtenemos una salida con el valor del atributo name en cada linea del shelll<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tengo un directorio con ficheros XML, tienen etiquetas del tipo &lt;process id=&#8221;&#8230;&#8221; name=&#8221;&#8230;&#8221; &#8230;.&gt; y necesito extraer todos los valores del atributo name, Con Bash es muy sencillo usando este comando: grep -oP &#8216;]*name=&#8221;[^&#8221;]*&#8221;&#8216; *.xml | sed -E &#8216;s\/.*name=&#8221;([^&#8221;]*)&#8221;.*\/\\1\/&#8217; As\u00ed &hellip; <a href=\"https:\/\/blogs.ua.es\/jpm33\/2024\/11\/22\/extraer-atributo-de-una-etiqueta-xml-en-lote\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3080,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[236748,236729,236749],"class_list":["post-683","post","type-post","status-publish","format-standard","hentry","category-linux","tag-bash","tag-linux","tag-xmlm"],"_links":{"self":[{"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/posts\/683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/users\/3080"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/comments?post=683"}],"version-history":[{"count":2,"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/posts\/683\/revisions"}],"predecessor-version":[{"id":686,"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/posts\/683\/revisions\/686"}],"wp:attachment":[{"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/media?parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/categories?post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ua.es\/jpm33\/wp-json\/wp\/v2\/tags?post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}