qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] iotests: _filter_qmp for pretty JSON output


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2/3] iotests: _filter_qmp for pretty JSON output
Date: Wed, 12 Nov 2014 06:19:56 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/12/2014 01:33 AM, Max Reitz wrote:

>>> +        -e 's#^{"QMP":.*}$#QMP_VERSION#' \
>>> +        -e 's#\\#\\\\#g' | \
>>> +        while IFS='' read line; do
>>> +            if [[ $line == '    "QMP": {' ]]; then
>> Good that this is a /bin/bash script and not /bin/sh :)
> 
> Ah, right, yes, I just copied the code I had written for filtering out
> the image-specific information from the qemu-img info output.
> 
>> But - is it really worth doing this in shell?  Why not just do it in sed?
> 
> Because I don't know sed well enough. ;-)
> 
>> sed -e ... \
>>      -e 's#\\#\\\\#g' \
>>      -e '/    "QMP": {/,/    }/ c\' \

Better make this line anchored in its searching:

-e '/^    "QMP": {$/,/^    }$/ c\' \

>>      -e '    QMP_VERSION'
> 
> Will do, thanks.
> 
> Max
> 
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]