You could use calibre's "Tweak Book" option available on the book's right-click menu, then do whatever you like to your book using your preferred text editor; or you could edit the ePub with Sigil.
I would suggest taking a backup of the book before any 'raw' editing, just in case things go wrong. I copy books to a separate calibre library, (Work In Progress), for just such purposes. When you're happy with the result you simply copy it back to your main library and delete from WIP. (Copy functions are also available on the right-click for a book.)
For more details on "Tweak Book" see the Calibre for Beginners Guide* at:
http://stu.wccnet.edu/~rprice/Eng218/CalibreHelp/
then go to: Other Fun Stuff > Editing an eBook with Tweak Books.
*Courtesy of calibre user and mobileread member BeccaPrice