Skip to content

Instantly share code, notes, and snippets.

@johnkerl
Created January 13, 2022 13:55
Show Gist options
  • Save johnkerl/b381ad9bc2003acc94a114cce629a921 to your computer and use it in GitHub Desktop.
Save johnkerl/b381ad9bc2003acc94a114cce629a921 to your computer and use it in GitHub Desktop.
$ 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