RC Logr 20190406 181729
Saturday, 6 Apr, 2019
I often need to replace dates in the frontmatter of markdown files, in «RFC 3339» format for content in static site generator Hugo. A simple shell function using gnu date, sed, head and pbcopy puts the current timestamp on the clipboard easily. 👻
|
|
Here is how it works:
- Gnu date with the
--rfc-3339
switch gives us a timestamp like2019-04-06 18:38:19+09:00
, is piped to… sed
which replaces the space with a T, then that is piped to…head
to remove the trailing newline, which is finally piped topbcopy
to put the result on the clipboard (MacOS only).
Then just paste it where you need it. By the way, the timestamp means “18:38:19 in the timezone +9 hours ahead of GMT”, or, Japan time.
RC Logr 20190406 181729 - I often need to replace dates …