Only remove the first and last lines if they contain the -----BEGIN statement.