Re: strip text up to a keyword?

From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 10/10/03


Date: 10 Oct 2003 11:42:48 GMT

Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> kw <anon002001@yahoo.com> wrote:
>
> > Is there a relatively simple way to strip/delete all text from a file,
> > up to a keyword?
>
>
> No.

Well, there is, but the OP doesn't need it (because the text is in memory
anyway). This prints blocks from "BEGIN" to "END" from a file:

    while ( <DATA> ) {
        print if s/.*(?=BEGIN)// .. s/(?<=END).*//;
    }
    
Anno



Relevant Pages

  • Re: lwp::simple and rget--can I compare
    ... Tad McClellan ... have Perl commit that to memory; then wait for a determined amount of ... to memory earlier, and then compare the old, memory-committed version ... if ($firstcopy ne $secondcopy) { ...
    (comp.lang.perl.misc)
  • Re: lwp::simple and rget--can I compare
    ... Tad McClellan ... have Perl commit that to memory; then wait for a determined amount of ... to memory earlier, and then compare the old, memory-committed version ... if ($firstcopy ne $secondcopy) { ...
    (comp.lang.perl.misc)
  • Re: Using memory pool with operators new/delete
    ... pre-allocated memory pool that manages only blocks of the same size (the ... The call number works correctly (it allocates the memory and calls the ... can't be an ordinary function call but it also won't be called by the syntax ... Use of the delete keyword never calls operator delete with multiple ...
    (microsoft.public.vc.language)
  • Re: restrict keyword from ISO C99?
    ... > it is suppose to restrict access to memory locationpointed to, ... > so that only one declared pointer ... The restrict keyword is a promise by the programmer to the compiler ...
    (comp.lang.c)
  • Re: FAQ 5.38 Why do I get weird spaces when I print an array of lines?
    ... Tad McClellan: ... > Christian Maier: ... I was more worried about the memory such a join would need. ... "Gewoon is een tijger." ...
    (comp.lang.perl.misc)