#!/usr/bin/mawk -f BEGIN { sep = "=============================================================================" } FILENAME ~ /debian$/ { exit } /^== END PATCH$/ { print "" exit } FNR == 1 { print FILENAME "\n" substr(sep, 0, 1+length(FILENAME)) "\n" next } { print }