I'm fairly new to Linux and shell scripting; and have a requirement to parse and query an xml. I was able to find and use XML starlet for Windows successfully.
However, my goal is to have that run on Linux via a shell script.
Can anyone please share the steps to install and configure XMLStarlet on Linux?
Thanks!
XMLStarlet is a set of command line utilities (tools) which can be used to transform, query, validate, and edit XML documents and files using simple set of shell commands in similar way it is done for plain text files using UNIX grep, sed, awk, diff, patch, join, etc commands.
So, open a terminal (or other command line interface) and execute xpath . Since most terminals (or other command line interfaces) have auto-completion you could also simply type xpa and press tab . If it autocompletes to xpath , then you know it is installed.
For Ubuntu:
sudo apt-get update
sudo apt-get install xmlstarlet
For CentOS: It is present in epel repo, download the repo and enable it
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Confirm if it is enabled or not
cd /etc/yum.repos.d
grep -re enabled=1
This should show
epel.repo:enabled=1
Then Download xmlstarlet
sudo yum -y install xmlstarlet
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With