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

With sed I can extract data from an HTML file? For example like this:


Extract this output:


In my text editor I use the following regular expression:

share|improve this question
This is not a do my work for me site. I could solve this easily but you haven't even bothered to make a polite question out of it. – Nifle Mar 7 '10 at 14:46
This way madness lies:… – Dennis Williamson Mar 7 '10 at 15:00
Politeness helps – fpmurphy1 Mar 7 '10 at 15:10
@Nifle: I understand. I was too direct. Sorry. – Sebtm Mar 7 '10 at 15:45
No need to all pile onto a new user. Politeness from old users helps, too. – JRobert Mar 8 '10 at 0:10

Not a sed solution but an XSLT one

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" >
<xsl:output method="text" />

  <xsl:template match="//table/tr">
     <xsl:value-of select="descendant::td[1]"/>
     <xsl:text>  </xsl:text>
     <xsl:value-of select="descendant::td[2]"/>
     <xsl:text>  </xsl:text>
     <xsl:value-of select="descendant::td[3]"/>
     <xsl:text>  </xsl:text>
     <xsl:value-of select="descendant::td[4]"/>

share|improve this answer
But if HTML is malformed, this solution works? – Sebtm Mar 7 '10 at 15:48

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.