Skip to content

Instantly share code, notes, and snippets.

@leejarvis

leejarvis/blah Secret

Created March 5, 2012 15:16
Show Gist options
  • Save leejarvis/e5d28dd048ab1ce6b144 to your computer and use it in GitHub Desktop.
Save leejarvis/e5d28dd048ab1ce6b144 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
text = <<-EOL
foo
bar
Invoked...
hello
there!
Completed...
other
EOL
lines = text.split("\n")
new_lines = lines.select.with_index do |l, i|
i > lines.index('Invoked...') && i < lines.index('Completed...')
end
p new_lines #=> ['hello', 'there!']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment