Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have some documentation in an html table. I want to convert the table to an ascii table, like you see when you get a mysql command line result back, like this:

+------------+------------+
| header     | header     |
+------------+------------+
| cell data  | cell data  |
+------------+------------+
| cell data  | cell data  |
+------------+------------+

... so I can include it in some code comments.

How could I do this easily? I was thinking piping the output of lynx into a file, but lynx doesn't put ascii borders around tables :P

I also want to control cell width, so that the content cells don't spill outside the accepted screen width of the code.

share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

You are better off using links for table rendering:

links -width 80 -dump http://website.com/ > file.html
share|improve this answer
2  
or links 2 or elinks or w3m. Try them all and see whose rendering you like best. –  Gilles Mar 1 '11 at 21:59
    
Yes, the version I tested with was actually links2 –  jamespo Mar 1 '11 at 22:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.