Re: [SLUG] extract a block of text between tags.

From: Dylan William Hardison (dylanwh@tampabay.rr.com)
Date: Fri Jul 25 2003 - 17:18:56 EDT


I think this would work better:
perl -ne'print if /begin/ .. /end/' file

or this:
perl -ne'print if s/begin// .. s/end//' file

cheerio.

On Friday, July 25, 2003 at 05:52PM -0400, btt@nethouse.com wrote:
> On Fri, Jul 25, 2003 at 12:13:11PM -0700, Michael Manchester wrote:
> > I would like to extract some text from a file that is
> > between tags. Such as
> > begin
> > ....
> > .... some text
> > ....
> > end
> > I thought I had seen somewhere away to use grep, sed
> > or awk to extect the sometext between the tags. But
> > google searches are coming up empty as is my memory.
> > Does anyone have away to do this?
>
> I doubt this is what you want, but it is friday so here goes.
>
> $ cat file | perl -00 -ne 's/begin\n(.+?)end/print($1)/se'
>
> Muahahah... :)
>
> Cheers,
> Bill
>

-- 
Bad men live that they may eat and drink, whereas good men eat and drink
that they may live.
              -- Socrates
-
GPG Fingerprint=D67D 2B75 53C6 9769 30E4  D390 239F C833 F32C F6F6
GPG KeyID=F32CF6F6



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:56:59 EDT