BEGIN {RS="----->"} /5\. select \* from mytable/ { printf("%s %s",RS,$0)}