Skip to content

Instantly share code, notes, and snippets.

@FabioFleitas
Created August 8, 2015 02:05
Show Gist options
  • Save FabioFleitas/450eed0d3a7119413b9b to your computer and use it in GitHub Desktop.
Save FabioFleitas/450eed0d3a7119413b9b to your computer and use it in GitHub Desktop.
Displays EXAMPLES section of man pages
eg() {
MAN_KEEP_FORMATTING=1 man "$@" 2>/dev/null \
| sed --quiet --expression='/^E\(\x08.\)X\(\x08.\)\?A\(\x08.\)\?M\(\x08.\)\?P\(\x08.\)\?L\(\x08.\)\?E/{:a;p;n;/^[^ ]/q;ba}' \
| ${MANPAGER:-${PAGER:-pager -s}}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment