Generally, yes you can remove the lines before and after the "Begin RSA Private Key" and "End RSA Private Key (and the like.) This includes Microsoft
IIS servers which add some additional information lines.
The only exception is Begin Encrypted Private Key which may have its own section before the Begin Private Key line. But usually the
"Proc-Type: 4,ENCRYPTED" line is part of Private Key Section such as below and should be retained:
-----BEGIN RSA PRIVATE KEY-----
Also watch leading and trailing blanks at the start or end of the Begin or End lines.