Home | Articles | CV (pdf)
<2011-11-27> by Lorenzo Bolla

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
$> hsgrep <string> <filename>