最好使用perl或unix命令来解析此字符串

jda*_*mae 0 unix perl

是否有一个好的unix one衬里或perl衬里可以格式化这个字符串:

<?xml version="1.0" encoding="UTF-8"?><org.apache.Summary length="200429142" fileCount="197184" dirCount="50" quota="-1" spaceUsed="601287428" spaceQuota="-1"/>
Run Code Online (Sandbox Code Playgroud)

至:

length=200429142
filecount=197184
dirCount=50
quota=-1
spaceUsed=601287428
spaceQuota=-1
Run Code Online (Sandbox Code Playgroud)

Sea*_*ean 6

这是一个单行,为了清晰起见分成不同的行:

perl -MXML::Simple -l \
    -e '$a = XMLin shift; print "$_=$a->{$_}" for ' \
    -e 'qw(length fileCount dirCount quota spaceUsed spaceQuota)' \
    (your XML string here)
Run Code Online (Sandbox Code Playgroud)

这需要您XML::Simple安装模块.