Skip to content

Instantly share code, notes, and snippets.

@nabinno
Last active November 9, 2019 11:29
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 nabinno/797f20072b19ca7190003c15b43fd716 to your computer and use it in GitHub Desktop.
Save nabinno/797f20072b19ca7190003c15b43fd716 to your computer and use it in GitHub Desktop.
Generate markdown files from titles.
#!/usr/bin/env bash
set -e
generateContent() {
local tags="$1"
local title="$2"
cat <<EOF
---
title: ${title}
tags: ${tags}
url:
---
EOF
}
convertToSnakeCase() {
local string="$1"
echo "${string}" |
tr '[:upper:]' '[:lower:]' |
sed -r 's/(\(|\))//g' |
sed -r 's/( )([a-z0-9])/_\2/g'
}
while read TAGS TITLE; do
generateContent "${TAGS}" "${TITLE}" >"$(convertToSnakeCase "${TITLE}").md"
done <title.tsv
python,database Big Data Fundamentals via PySpark
python,database Building Recommendation Engines with PySpark
python,database Data Types for Data Science
python,database Feature Engineering with PySpark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment