Skip to content

Instantly share code, notes, and snippets.

@dmalikov
Created September 17, 2012 14:24
Show Gist options
  • Save dmalikov/3737645 to your computer and use it in GitHub Desktop.
Save dmalikov/3737645 to your computer and use it in GitHub Desktop.
GREP PATTERN -A ∞
{-# LANGUAGE UnicodeSyntax #-}
import Control.Applicative ((<$>))
import System.Environment (getArgs)
import Text.Regex.Posix ((=~))
main ∷ IO ()
main = do
pattern ← head <$> getArgs
mapM_ putStrLn =<< dropWhile (\α → not $ α =~ pattern) . lines <$> getContents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment