Ris*_*shi 2 xml linux shell xmlstarlet xml-parsing
我对Linux和Shell脚本还很陌生。并且需要解析和查询xml。我能够成功找到并使用Windows的XML starlet。
但是,我的目标是通过外壳程序脚本在Linux上运行它。
谁能分享在Linux上安装和配置XMLStarlet的步骤?
谢谢!
对于Ubuntu:
sudo apt-get update
sudo apt-get install xmlstarlet
Run Code Online (Sandbox Code Playgroud)
对于CentOS:它存在于epel仓库中,下载该仓库并启用它
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Run Code Online (Sandbox Code Playgroud)
确认是否启用
cd /etc/yum.repos.d
grep -re enabled=1
Run Code Online (Sandbox Code Playgroud)
这应该显示
epel.repo:enabled=1
Run Code Online (Sandbox Code Playgroud)
然后下载xmlstarlet
sudo yum -y install xmlstarlet
Run Code Online (Sandbox Code Playgroud)
Sri*_*ram -1
如果您使用的是 Ubuntu/Debian,请在终端中运行以下命令:
sudo apt-get update
sudo apt-get install xmlstarlet
Run Code Online (Sandbox Code Playgroud)
如果操作系统是 Centos
Download latest epel-release rpm http://download-ib01.fedoraproject.org/pub/epel/6/x86_64/
Install epel-release rpm:
$ sudo rpm -Uvh epel-release*rpm
Install xmlstarlet rpm package:
$ sudo yum install xmlstarlet
Run Code Online (Sandbox Code Playgroud)
或从https://centos.pkgs.org/6/epel-x86_64/xmlstarlet-1.3.1-1.el6.x86_64.rpm.html下载