Created
January 12, 2019 15:21
-
-
Save jiyeonseo/2b30b152767caeb5f334fe4882cecfd3 to your computer and use it in GitHub Desktop.
migration_post.sh
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
#!/bin/bash | |
for entry in "$PWD"/blog/* | |
do | |
writeAt=$(basename $entry | awk -F'[-.]' '{print $1"-"$2"-"$3}') # extract data from file name | |
dateFormat='date: '$writeAt'' # date string aligned with markdown format | |
printf '%s\n' H 4i "$dateFormat" . wq | ed -s $entry # insert date string. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script is for migration blogs post which don't have "date" info in the file.
extracting date from file name and insert into file as
date: '2019-01-13'