Solution in TXR.

$ txr data.txr data
qwe rty
uio {asd fgh jkl zxc}
vbn
mqw rty
data
is:
qwe rty
uio {asd
fgh jkl
zxc} vbn
mqw rty
data.txr
is:
@(repeat)
@ (cases)
@pre{@post
@(freeform " ")
@rest} @; <-- space after @rest} here.
@ (do (put-line `@pre{@post @rest}`))
@ (or)
@nomatch
@ (do (put-line nomatch))
@ (end)
@(end)
@pre@{post
means we match a line which contains a {
character. Everything before the {
character goes into the pre
variable; everything after goes to post
.
Then freeform " "
means that for the purposes of subsequent matching, the input lines are considered to be one single line, in which they are joined by spaces. Inside this one giant line we match @rest}
: a prefix portion which goes into the variable rest
up to a closing brace, and we match the brace also and a following space. If all this material matches, we output it as one line.
If there is no match such as the above, the second case matches a line, capturing it into nomatch
and that is put out as-is.
The surrounding repeat
then marches down past the matched lines to try matching again.