Created
May 21, 2023 19:48
-
-
Save shaisachs/4eac0ad808fdb795bec47bf03d38c462 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
# add date: field to every post in a directory, using the last git commit date for that post | |
for f in * ; do | |
echo $f | |
d=`git log -n 1 --date=format:'%Y-%m-%d %H:%M:%S' $f | grep Date | cut -c 9-` | |
sed -i -e '/^title:/a\ | |
date: "$d" | |
' "$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment