Last active
March 2, 2017 21:10
-
-
Save ghostbar/ed98f2c8fb604d9747bcc3b0391019c2 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
modify_file() { | |
sed -i "s/title/date\: $2T00:00:00-04:00\ntitle/" "$1" | |
} | |
for item in *.md; do | |
exists="$(grep "^date: " "$item")" | |
if [ -z "$exists" ]; then | |
echo "$item" | |
what_date="$(echo "$item" | cut -c 1-10)" | |
modify_file "$item" "$what_date" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment