Created
November 22, 2012 00:38
-
-
Save hden/4128725 to your computer and use it in GitHub Desktop.
Parse csv to tabular file. Usage: $ coffee csv2tab.coffee inputFile > outputFile
This file contains hidden or 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
| csv = require("ya-csv") | |
| util = require("util") | |
| file = "input.txt" | |
| file ?= process.argv[2] | |
| reader = csv.createCsvFileReader file, | |
| separator: "," | |
| quote : "\"" | |
| escape : "\"" | |
| comment : "" | |
| reader.addListener "data", (data) -> | |
| for col in data | |
| col ?= " " | |
| if _i is _len - 1 | |
| util.puts col | |
| else | |
| util.print col + "\t" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment