Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Created September 19, 2011 01:43
Show Gist options
  • Select an option

  • Save RichardBronosky/1225826 to your computer and use it in GitHub Desktop.

Select an option

Save RichardBronosky/1225826 to your computer and use it in GitHub Desktop.
# oneliner
# grep_header(){ header_pattern="$1"; search_pattern="$2"; awk "/$header_pattern/ {h=\$0; } /$search_pattern/{if(h){print h; h=\"\";}; print \$0;}"; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment