Created
January 13, 2022 13:55
-
-
Save johnkerl/b381ad9bc2003acc94a114cce629a921 to your computer and use it in GitHub Desktop.
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
$ cat deslurm2.mlrsh | |
#!/usr/bin/env mlr -s | |
--csv | |
put ' | |
func deslurm(str s): num { | |
# example "5-18:53:20" | |
fields = unformat("{}-{}:{}:{}", s); | |
days = fields[1]; | |
hours = fields[2]; | |
minutes = fields[3]; | |
seconds = fields[4]; | |
return seconds + minutes * 60 + hours * 3600 + days * 86400; | |
} | |
$y = deslurm($x); | |
$z = sec2dhms($y); | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment