Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
367 views
in Technique[技术] by (71.8m points)

xmllint - Parse specific data in an XML file

So this is the full XML file:

<?xml version="1.0" encoding="UTF-8"?>
<ldap_users><size>1</size><ldap_user><uid>1396255</uid><uuid/><username>JSmith</username><realname>John Smith</realname><real_name>John Smith</real_name><email_address>[email protected]</email_address><phone/><phone_number/><building/><department/><room/><position/></ldap_user></ldap_users>

I am trying to only get the information for the "real_name" output into terminal when I run my script. Currently I have the script downloading the XML locally and then running xmllint like this:

sudo -u root xmllint --xpath 'string(//@real_name)' /Library/Application Support/JAMF/user.xml

But I am not getting anything in terminal. Can someone show me the right way if this is possible? If I am doing something wrong, what is the right way?

question from:https://stackoverflow.com/questions/65893352/parse-specific-data-in-an-xml-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...