I have a text file (Markdown, actually, but close enough) with dates in a slightly annoying US format %m/%d/%Y
. I'd like it to be in ISO-8601 format everywhere throughout.
I could easily write a 5-10 line script to do this specific conversion, but it feels like the sort of thing someone has written a more complete version of already. I just don't know what this hypothetical tool is called.
My imagined tool would take arbitrary formats for input and output (but from the world of datetime formats), although maybe with shortcuts for common ones. Basically, a datetime-aware sed
is what I would want. So I might run, e.g.:
$ datecvt -i US -o ISO8601 < myfile.txt > gooddates.txt
$ # ... or ...
$ datecvt -i '%m/%d/%Y' -o '%Y-%m-%d' --inplace myfile.txt
Perhaps slightly different usage syntax, but that sort of thing. Does it exist? (for OSX, but almost all Linux-oriented tools can be compiled, and have been with Homebrew).