Skip to content

Instantly share code, notes, and snippets.

@selbyk
Created March 17, 2016 16:37
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 selbyk/88e33f340db812902a24 to your computer and use it in GitHub Desktop.
Save selbyk/88e33f340db812902a24 to your computer and use it in GitHub Desktop.
Format ms power point slide text from operating systems into markdown
#!/bin/bash
# Usage: ./replace.sh
#* Adapted from slides by Reva Freedman (The UNIX Systems), NIU
### Feng Chen
### Tue/Thu 5:00-6:30PM
#1120 Patrick F. Taylor Hall
# https://github.com/selbyk/operating-systems
FILE="16.shell.programming.md"
shopt -s extglob
for FILE in {9,1[0-5]}.*.md
do
sed -i.bak -e "s/^.*Cont.)//gm" $FILE
sed -i.bak -e "s/^.*, LSU$//gm" $FILE
sed -i.bak -e "s/Feng Chen.*Chapter [0-9]*//gm" $FILE
sed -i.bak -e "s/^■ /- /gm" $FILE
sed -i.bak -e "s/^• / - /gm" $FILE
sed -i.bak -e "s/^● / - /gm" $FILE
sed -i.bak -e "s/^! / - /gm" $FILE
sed -i.bak -r "s/^^([A-Z].+)/### \1/gm" $FILE
sed -i.bak -r "s/^- ([a-zA-Z]*) –/- **\1** –/gm" $FILE
sed -i.bak -r "s/### (.*)===$/\1\n===/" $FILE
done
rm ./*.bak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment