Last active
January 2, 2017 02:40
-
-
Save ScalaWilliam/12a56023e913cb8c3f635243637abd37 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/jjs | |
function isoTime(unixTime) { | |
var instant = java.time.Instant.ofEpochSecond(unixTime); | |
return java.time.format.DateTimeFormatter.ISO_INSTANT.format(instant); | |
} | |
java.nio.file.Files.lines( | |
java.nio.file.Paths.get("/dev/stdin") | |
).map(function (line) line.split(",", -1)) | |
.map(function(columns) { columns.unshift(isoTime(columns[0])); return columns }) | |
.map(function(columns) columns.join(",")) | |
.forEach(print); | |
/** | |
Usage: | |
./prepend-iso-time.js <<EOF | |
1552134142,a | |
1552134143,b | |
1562134142,c | |
EOF | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment