Skip to content

Instantly share code, notes, and snippets.

@innermond
Created October 24, 2014 12:30
Show Gist options
  • Save innermond/eb0a13b965ea9c5a34e1 to your computer and use it in GitHub Desktop.
Save innermond/eb0a13b965ea9c5a34e1 to your computer and use it in GitHub Desktop.
Remove all extra newlines and make the paragraphes pandoc-able
#!/bin/bash
files=$1
for file in $files; do
# first delete all empty, succesive lines
# then add an extra newline
sed -i -r ':a;/^$/{d;ba};x;s/^.+$/\n/g;p;x' "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment