-1

I'm looing for a way to extract my data from the below XML file structure:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>**MyClassController**</members>
        <name>ApexClass</name>
    </types>
    <version>51.0</version>
</Package>

The expected result is MyClassController. What is the command I should use and can you please give me a sample?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Achiko T
  • 3
  • 1

1 Answers1

0

This answer may help How to parse XML using shellscript?

Easier way is, if you know exactly what tag you want you can do

rg -o '<members>(.*)</members>' -r '$1' < your.xml

rg is ripgrep (https://github.com/BurntSushi/ripgrep), a great tool but you need to install

Leo Liu
  • 510
  • 4
  • 8