Skip to content

Instantly share code, notes, and snippets.

@jballanc
Created February 14, 2014 18:43
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 jballanc/9006572 to your computer and use it in GitHub Desktop.
Save jballanc/9006572 to your computer and use it in GitHub Desktop.
> cat sample.txt
first
second
start
third
fourth
fifth
sixth
stop
seventh
eigth
ninth
tenth
> ruby -ne "BEGIN { i = 0 } ; i += 1 if /start/../stop/ ; END { puts \"There were #{i} lines between 'start' and 'stop'\" }" < sample.txt
There were 6 lines between 'start' and 'stop'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment