Skip to content

HSGrep: Sorted Grep in Haskell

As an exercise to learn Haskell, I wrote a specialized grep to work on sorted files. It uses binary search to scan a text file and print all the (consecutive) lines that start with a user defined string.

My program is a rewrite of sgrep in Haskell: I called it HSGrep.

Code is available on github.

Thanks a lot for all your useful suggestions! As soon as possible, I’ll post some benchmarking here. (EDIT: benchmarks now available!)

After downloading the source code, build installĀ and run it with:

$> cabal build
$> cabal install
$> hslint <string> <filename>

{ 1 } Trackback

  1. lorenzo bolla's blog : HSGrep benchmarking | November 30, 2011 at 11:38 pm | Permalink

    [...] days ago, I rewrote sgrep in Haskell. I was curious to know how it compares to grep in term of execution speed. In particular, I was [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *