Created
December 21, 2011 12:54
-
-
Save kkirsanov/1505942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
infinityString st = st ++ infinityString st | |
split :: String->Char->[String] | |
split [] ch = [] | |
split st ch = start : split ending ch where | |
(start, e) = break (==ch) st | |
ending = drop 1 e | |
parseCSV t = mails where | |
lines = split t '\n' | |
tabbed = map (`split` '\t') lines | |
col = map (!!3) tabbed | |
filtered1 = map (filter ( /='\"')) col | |
filtered2 = filter (elem '@') filtered1 | |
mails = filtered2 | |
main = do | |
text <- readFile "data.csv" | |
mapM_ putStrLn (parseCSV text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment