Rom*_*hin 1 linux bash shell parsing
我有一个输出:
<artifactId>prj-parent</artifactId>
<version>1.11.1-Beta01-SNAPSHOT</version>
Run Code Online (Sandbox Code Playgroud)
如何使用linux命令仅提取1.11.1-Beta01-SNAPSHOT?谢谢!
你可以使用grep:
echo $string | grep -P -o '(?<=<version>).*?(?=</version>)'
Run Code Online (Sandbox Code Playgroud)