From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoXqB-0005nY-2v for qemu-devel@nongnu.org; Wed, 12 Nov 2014 08:20:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoXq2-0007Ec-Dx for qemu-devel@nongnu.org; Wed, 12 Nov 2014 08:20:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoXq2-0007EY-5x for qemu-devel@nongnu.org; Wed, 12 Nov 2014 08:19:58 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sACDJvwY013483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 12 Nov 2014 08:19:57 -0500 Message-ID: <54635E7C.2020604@redhat.com> Date: Wed, 12 Nov 2014 06:19:56 -0700 From: Eric Blake MIME-Version: 1.0 References: <1415712873-29274-1-git-send-email-mreitz@redhat.com> <1415712873-29274-3-git-send-email-mreitz@redhat.com> <5462E67E.7000607@redhat.com> <54631B64.5080704@redhat.com> In-Reply-To: <54631B64.5080704@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Jp50H1FfAuohX0iax44W4JQdTlPEkNiUw" Subject: Re: [Qemu-devel] [PATCH 2/3] iotests: _filter_qmp for pretty JSON output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Markus Armbruster , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Jp50H1FfAuohX0iax44W4JQdTlPEkNiUw Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/12/2014 01:33 AM, Max Reitz wrote: >>> + -e 's#^{"QMP":.*}$#QMP_VERSION#' \ >>> + -e 's#\\#\\\\#g' | \ >>> + while IFS=3D'' read line; do >>> + if [[ $line =3D=3D ' "QMP": {' ]]; then >> Good that this is a /bin/bash script and not /bin/sh :) >=20 > Ah, right, yes, I just copied the code I had written for filtering out > the image-specific information from the qemu-img info output. >=20 >> But - is it really worth doing this in shell? Why not just do it in s= ed? >=20 > Because I don't know sed well enough. ;-) >=20 >> sed -e ... \ >> -e 's#\\#\\\\#g' \ >> -e '/ "QMP": {/,/ }/ c\' \ Better make this line anchored in its searching: -e '/^ "QMP": {$/,/^ }$/ c\' \ >> -e ' QMP_VERSION' >=20 > Will do, thanks. >=20 > Max >=20 >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Jp50H1FfAuohX0iax44W4JQdTlPEkNiUw Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUY158AAoJEKeha0olJ0NqyicH/1VAceUWacSet7CcuZN/V98l G/2LjS4/2bGnUvPUxmqir0PNg2AEEwXBhhxq6fziBXE8znMGflgtzgGrS0eVBi1X HWqqESx2FcYCBrEoMBBxERJHEN+oSK434PGMxe8KTXHkisv6N5FuLn6HQpT/z2yq GKwI3pYNB3acBFX/cmMGvMmP+Vgd2PGzzKINIUM4WJpFmDuxrUpJbGZkMzdFin3H 2J8jgBO9tm7AkT0YNINguZqdpmfGwjoXoaDEZcGOsYV95x91U5XknV/0YEjdBLcA UoHMQyHYbPJQ5bfA7alntQH5IapQrzJcoTNvIy7jk0QWR4V9urp9/Z9LjVL0B1s= =4Pgf -----END PGP SIGNATURE----- --Jp50H1FfAuohX0iax44W4JQdTlPEkNiUw--