/^/ { name="" } /^/ { idx=index($0, "**") if (idx > 0) { name=substr($0, idx+2) } } /^/ { if (length(name) > 0) { print "" name next } } { print }