I would like to be able to provide last modified timestamps to my Jekyll posts and pages using a shell script. The problem is that I do not know how to automatically generate an acceptable timestamp. The closest I have come to acceptable timestamp is using this command:
stat <FILE> | sed -n -e 's/Modify:\s//p'
which returns for my glossary.md file:
2016-02-12 09:37:55.393936224 +1000
this is almost the format I want. The only problem is I would like to remove the decimal
.393936224 from it. I thought I could manage this myself using
sed but all my attempts have failed. Most of my attempts involved writing this output to a text file and then using sed on this text file to remove the decimal. I would prefer any answer you give to not write the output of this to a text file, although I would like the output of your solution to be writable to a variable. e.g., if the variable is
L=$(stat <FILE> | sed -n -e 's/Modify:\s//p' | sed ...)
| sed ... can be replaced with whatever your solution to this problem is.