man sed:
q: Immediately quit the sed script without processing
any more input, except that if auto-print is not disabled
the current pattern space will be printed.
Javíts ki, ha vmit félreértelmeztem volna, de amint egyszer eljut a 'q' parancsig a vezérlés, a sed leáll. Tehát az első nyitó tagtől az első záróig fut.
kl223