Match regex across multiple lines in bash
问题 I want to match all patterns that start with [% and end with %] in a file. I've tried multiple tools such as awk, sed, pcregrep and none of them seem to work, although they are suggested as top answers on similar questions. [% FOREACH selection = selections -%] case SELECTION_ID_[% SELECTION_NAME %]: { const [% selectionType %]& source = this->[% selectionName %](); rc = bcem_AggregateUtil::toAggregate(result, d_selectionId, source); } break; [% END -%] [% foo ] [% INCLUDE