Skip to content

Instantly share code, notes, and snippets.

@goofrider
Last active September 26, 2020 19:43
Show Gist options
  • Save goofrider/05a67db938cccc5039f45d0abf00be4e to your computer and use it in GitHub Desktop.
Save goofrider/05a67db938cccc5039f45d0abf00be4e to your computer and use it in GitHub Desktop.
[shell one-liners] Some usefuel shell one-liners #shell #bash #zsh #sed
#### Remove YAML frontmatter. Requires GNU sed. OSX sed doesn't seem to work.
gsed '1 { /^---/ { :a N; /\n---/! ba; d} }
#### Remove '#' comments, empty lines and leading/trailing spaces
sed 's/#.*$//
s/[[:space:]]//g
/^$/d'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment