Created
February 20, 2020 16:52
-
-
Save blairmacintyre/479178dd5ffb53619fa2351a6975fefe to your computer and use it in GitHub Desktop.
convert a "email, name" csv to the json file needed by hubs-cloud account upload
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
#!/bin/sh | |
awk ' | |
BEGIN { | |
print "{ \"data\": [" | |
FS = ",[ \t]+" | |
first = 1 | |
} | |
{ | |
if (first) { first = 0 } else { print ","} | |
email = gensub("\"", "\\\\\"", "G", $1) | |
name = gensub("\"", "\\\\\"", "G", $2) | |
print "{ \"email\": \"" email "\", \"name\": \"" name "\"}"} | |
END {print "]}"} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment