use strict; use warnings; while ( $_ = and /^\.subckt/../^\w/ ) { last if /^\w/; print; } __DATA__ .subckt cct0 v0 v1 v2 v3 + v4 v5 v6 * useless comment + v7 v8 v9 + va vb x00 v0 v1 x0 cct1 .ends