Dear Eric,
Eric Blake <[email protected]> writes:
>>> tr '\n' '\t' \
>>> | sed -e
>>> 's/{\s*"timestamp":\s*{[^}]*},\s*"event":[^,}]*\(,\s*"data":\s*{[^}]*}\)\?\s*}\s*//g'
>>> \
>>> | tr '\t' '\n'
>>
>> Nice trick. Why didn't I come up with it? ;)
>
> Mishandles any event whose data includes nested dicts. But a little bit
> more creativity can do it in two passes (the first modifies the stream
> to mark the start of an event, the second then does multiline matching
> to nuke the entire event):
>
> tr '\n' '\t' |
> sed 's/^{\(\s*"timestamp":\s*{[^}]*},\s*"event":\)/{MARK\1/g' |
> tr '\t' '\n' |
> sed '/^{MARK/,/^}/d'
This is starting to get too complex for my taste. If
_filter_qmp_events() isn't generic enough to be used by other test
cases, I can make it internal to 067. Alternatively I can port 067 to
Python, which can handle JSON data types natively with no need for
post-processing hacks.
Sascha
--
Softwareentwicklung Sascha Silbe, Niederhofenstraße 5/1, 71229 Leonberg
https://se-silbe.de/
USt-IdNr. DE281696641