Skip to content

Instantly share code, notes, and snippets.

@dickfeynman
Created August 12, 2014 00:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dickfeynman/77307df43f1852a241d4 to your computer and use it in GitHub Desktop.
Save dickfeynman/77307df43f1852a241d4 to your computer and use it in GitHub Desktop.
Fixing metadata for importing posts from Ruhoh to Hakyll
#!/bin/sh
# Strip single quotes of the date value
sed -i "/^date*/s/'//g" *.md
# Strip quotes off the tags list
sed -i "/^tags*/s/'//g" *.md
# Strip square brackets off the tags list
sed -i "/^tags*/s/\(\[\|\]\)//g" *.md
# Strip any blank lines among the first 5 lines
sed -i "1,5{/^$/d}" *.md
# Remove the categories
sed -i "/^categories/d" *.md
# Remove the type
sed -i "/^type/d" *.md
# Remove the description
sed -i "/^description/d" *.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment