Created
July 29, 2016 01:38
-
-
Save jetstreamin/36d81038c3cb536e364c24bf1a8ec65a to your computer and use it in GitHub Desktop.
this script parses the last, first and middle initial from a single column in a csv file. It uses fast-csv and parse-full-name to do so.
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
| const fs = require("fs"); | |
| var csv = require("fast-csv"); | |
| var parser = require("parse-full-name").parseFullName; | |
| fs.createReadStream("mydata.csv") | |
| .pipe(csv()) | |
| .on("data", function(data){ | |
| name = parser(data[0]); | |
| console.log(name.last + ',' + name.first + ',' + name.middle + ','); | |
| }) | |
| .on("end", function(){ | |
| console.log("done"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment