我想知道使用shellscript解析XML文件的最佳方法是什么?
如果你已经成功了,如果你能让我知道你是怎么做到的
我有一个pom.xml这样的
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.qualtrics.sujitv</groupId>
<artifactId>maven-test</artifactId>
<packaging>jar</packaging>
<version>1.2.3.4</version>
<name>Test app</name>
<url>http://maven.apache.org</url>
</project>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用xmllint获取版本,但是当我运行时
xmllint --xpath 'string(project/version)' ./pom.xml
Run Code Online (Sandbox Code Playgroud)
它什么也没输出
我有一个总是有 4 个“单词”的字符串
Strings:With:Four:Words and spaces
Run Code Online (Sandbox Code Playgroud)
并且需要在 Bash 中将其拆分为 4 个变量。所以..
var1="Strings"
var2="With"
var3="Four"
var4="Words and spaces"
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?