Delete line numbers from program code listings

Many of the books available on O’Reilly’s Safari Books Online come in HTML format, which I like because it makes it easy to copy code straight out of the book (no need to search for the “companion files”). However, program listings in books often use line numbers, which prevent the code from running if it’s just copied and pasted. That’s why I wrote this little tool to automatically remove the line numbers. It uses the first line to determine where the code starts and then applies the same format to the rest of the listing.

Please note: Internet Explorer likes to mangle up the results (it ignores the “text/plain” content-type HTTP header if it sees any tags), if this happens you’ll have to view the source to get your program listing.

One thought on “Delete line numbers from program code listings”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.