[Haskell-cafe] Re: literate Haskell newbie question

Stefan Monnier monnier at iro.umontreal.ca
Sat Mar 10 14:42:19 EST 2007


> cat foo.lhs | grep -e "^>" | sed "s/^> //"

Running for the Useless Use of cat Award?
A simpler version would be:

  sed -n -e 's/^>//p <foo.lhs

I don't guarantee that this will work correctly, tho.  Maybe

  sed -n -e 's/^> //p <foo.lhs

will work better?  This said, the OP talked about TeX, so presumably he uses
the other format, so maybe a better sed would be:

sed -n -e '/^\\begin{code}/,/\\end{code}/{/^\\begin{code}/d;/^\\end{code}/d;p}'
    <foo.lhs


-- Stefan



More information about the Haskell-Cafe mailing list