Skip to content

Instantly share code, notes, and snippets.

@pat-s
Created March 20, 2018 21:53
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 pat-s/7aa990030e0fd25a4eb727592da492d1 to your computer and use it in GitHub Desktop.
Save pat-s/7aa990030e0fd25a4eb727592da492d1 to your computer and use it in GitHub Desktop.
Convert NEWS.md to ASCII NEWS for R packages
# 1.'-e' part: Replaces all level 2 headers and appends a ":" at the end of the line
# 2.'-e' part: Indents all bullet points with a whitespace
# 3.'-e' part: Removes all level 2 headers
# 4.'-e' part: For all level 1 headers, add linebreak and 80 hyphens (not strictly required but clean)
# 5.'-e' part: Remove all level 1 headers
sed -e '/^##/ s/$/:/' -e 's/^*/ */' -e 's/^## *//' -e "/^#/a\\--------------------------------------------------------------------------------" -e 's/^# *//' < NEWS.md > NEWS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment