Skip to content

Instantly share code, notes, and snippets.

@tigerhawkvok
Created November 12, 2016 19:19
Show Gist options
  • Save tigerhawkvok/f91b5ae61ab8b9ccac6f3ca6e13473f4 to your computer and use it in GitHub Desktop.
Save tigerhawkvok/f91b5ae61ab8b9ccac6f3ca6e13473f4 to your computer and use it in GitHub Desktop.
Convert all HTML files into Markdown files in a given directory
#!/bin/bash
find . -type f -iregex .*\.html$ | while read line
do
printf 'Converting >>>%s<<<\n' "$line"
P_MD=${line%".html"}.markdown
pandoc --ignore-args -r html -w markdown < "${line}" | awk 'NR > 130' | sed '/<div class="site-info">/,$d' > "${P_MD}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment