Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
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.