extract-headers.sh: Helper functions, better output

Useful for diagnostics, and avoids duplication when adding new headers.