I have a folder of markdown files - I need to batch rename THE FILES. I need to prepend a date, and the date is inside the file in this format:
---- Title: Title-of-blog-article Date: 2012-03-07
I have managed to find a way to grab the date using awk. I can not seem to find the right magic to then take that date from awk and rename the file with it. Intended naming scheme:
OLD FILE Title-of-blog-article.md NEW FILE 2012-03-07-Title-of-blog-article.md
There are 150+ files in this folder. I've tried bash for loops and tested it with mv and echo. So far in the loop the awk variable never changes, just uses the field from the very first file. So I definitely need help.