Skip to content

Instantly share code, notes, and snippets.

@fourdollars
Created July 21, 2013 06:54
Show Gist options
  • Save fourdollars/6047759 to your computer and use it in GitHub Desktop.
Save fourdollars/6047759 to your computer and use it in GitHub Desktop.
A little script to parse Email from Registrano's CSV output.
#!/usr/bin/env lsc
require! csv
require! fs
speakers = []
csv!
.from.stream fs.createReadStream __dirname + \/coscup2013-cfp.csv, do
delimiter: \,
escape: \"
.to.path __dirname + \/sample.out
.transform (row) ->
row.unshift row.pop!
row
.on \record, ! (row,index) ->
status = row.19
if status == \允許:一般演講 or status == \座談會
if row.4? and row.4 is not ''
speakers.push "#{row.4} (#{row.3}) <#{row.2}>"
else if row.3? and row.3 is not ''
speakers.push "#{row.3} <#{row.2}>"
.on 'end', ! (count) ->
console.log speakers.join ", "
# console.log 'Number of lines: ' + count
return
.on 'error', ! (error) ->
console.log error.message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment