Extracting multiple lines from a file

R

Ron Coutts

This should be an easy question for Ruby-heads but I can't seem to
easily find the answer. I need to extract multiple lines from a file
where the lines are delimited by some other text. For example, with
file contents as shown below I'd like to extract the content between the
BEGIN_FOO and END_FOO lines. Can anyone tell me how to do that?

BEGIN_FOO
Some foo stuff here.
More foo stuff.
END_FOO

I've done this before in Perl (can't remember the syntax) so I'm
thinking it should be possible in Ruby.

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top