Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

How can I convert HTML tags to rtRTF or any rich format text using sed or any linux command-line tool?

I've achieved to strip them with sed 's/<[^>]*>//g', but I need the <b>hi</b> to convert to **hi**.

share|improve this question

html2text is a command-line tool that converts HTML to Markdown.

You will most probably get very frustrated trying to use sed to do this without error. The reason is touched upon in a legendary SO post. In very basic cases it might work, but it will come back to haunt you of you make it a habit, so learn how to do it correctly directly instead. Using a ready tool such as html2text is a lot better than trying to regex it out by hand.

share|improve this answer

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.