in reply to Selecting text between given words (multi-lines (/n) and multiple occurrences)
or if you can slurp#!/usr/bin/perl $goprint=0; while (<>){ if ($_ =~ /^Start(.*)/){$goprint=1} if ($_ =~ /^END(.*)/){$goprint=0;next} print "$_" if $goprint == 1; }
#Here's code that finds everything #between START and END in a paragraph: undef $/; # read in whole file, not just one line while ( <> ) { while (/START(.*?)END/sgm) { # /s makes . cross line boundaries print "$1\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Selecting text between given words (multi-lines (/n) and multiple occurrences)
by nylon (Acolyte) on Aug 29, 2003 at 08:05 UTC | |
by nylon (Acolyte) on Sep 01, 2003 at 05:44 UTC |