in reply to Finding part of a file

This one-liner will get you most of the way there... though the endpoints (banana and grape) are included in the output as well...
% perl -ne 'print if /^banana$/ .. /^grape$/' fruit.txt banana pear peach grape % cat fruit.txt apple banana pear peach grape orange

-Blake

Replies are listed 'Best First'.
Re: Re: Finding part of a file
by jbert (Priest) on Dec 04, 2001 at 19:42 UTC
    Are we allowed to assume a unix box?

    awk -e '/banana/,/grape/' fruit.txt

    Its always a good idea to remember where these good ideas come from :-)

    One side-effect of learning perl is that you become unable to write non-trivial awk, IME.

      I like sed:

      sed -n '/banana/,/grape/p' fruit.txt

      but find that almost anything I could do in sed, I would prefer to do in Perl. :-)

      Impossible Robot