I download a HTML file using wget command. I convert it into a text file using w3m.

wget -q0- www.example.com
w3m -dump index.html

I want to use only basic commands like wget, curl, etc. without installing any additional packages like w3m, lynx and html2text to convert HTML to text. Can you suggest some commands to do the same?

Any other method to get text of a webpage using basic commands are also appreciated.

  • Please add sample input and your desired output for that sample input to your question.
    – Cyrus
    Jan 27, 2019 at 7:54
  • 1
    Don't Parse XML/HTML With Regex. I suggest to use an XML/HTML parser (xmlstarlet, xmllint ...).
    – Cyrus
    Jan 27, 2019 at 7:57
  • @Cyrus Please make that an answer!
    – dessert
    Jan 27, 2019 at 9:19
  • So you want to parse a complex HTML/CSS/JavaScript document without using complex parsers? Or put it another way, you want to convert html to text without using a tool such as html2text? Or lets put it another way again, you want to download and parse an HTML file to convert to text, but only using a download tool like wget and not using a parsing and conversion tool like w3m? And someone should also make you a shirt without any needlework?
    – NeilG
    May 23 at 1:03


You must log in to answer this question.

Browse other questions tagged .