You could try TextWrangler for this sort of thing; much more capable than TextEdit, and if you use the direct install from BareBones Software instead of the App Store version, it will happily open locked files. When you try, it asks permission, reminding you that you are not a member of the required group, but password entry will allow you to open and edit the file. Plus, it has optional command line additions (also not built in to App Store version) that will allow you to use TextWrangler by entering edit (name of file) to open things directly from Terminal. Open File dialog has a handy "show invisibles" option to help you open and edit hidden or dot-prefixed files too. It's a free app so no risk in trying.