Home > front end >  how to extract data from an xml file using plutil?
how to extract data from an xml file using plutil?

Time:02-14

This is my file.xml

<key>FairPlayKeyData</key>
    <data>
    LS0tLS1CRUdJTiBD....S0tCg==
    </data>

I want the output to be: LS0tLS1CRUdJTiBD....S0tCg==

i try: plutil -key FairPlayKeyData file.xml

but output: unrecognized option: -key

CodePudding user response:

Use the -extract option:

-extract keypath fmt
outputs the value at 'keypath' in the property list as a new plist of type 'fmt'

fmt is one of: xml1 binary1 json raw

an additional "-expect type" option can be provided to test that the value at the specified keypath is of the specified "type", which can be one of: bool, integer, float, string, date, data, dictionary, array

plutil -extract FairPlayKeyData raw file.xml 
  • Related