Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 8 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
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
I tried both links2 and elinks, and did not get any border between cells. Could you please indicate whether you actually got them, and if so the version of links you used? – anol Mar 11 '15 at 16:39
@anol with elinks on centos 6 this works elinks -dump http://www.html.am/html-codes/tables however it depends if the table has borders configured itself – jamespo May 19 '15 at 19:38

Your Answer


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.