Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > how to extract multi-line text

Reply
Thread Tools

how to extract multi-line text

 
 
perltcl@yahoo.com
Guest
Posts: n/a
 
      07-19-2006
hi

how to extract multi-line text from a text file looking like this:
#!/bin/bash

....

BEGIN_TOKEN
multi-line text 1
.......
.......
END_TOKEN

BEGIN_TOKEN
multi-line text 2
.......
.......
END_TOKEN

BEGIN_TOKEN
multi-line text 3
.......
.......
END_TOKEN

I need to extract all text between "BEGIN_TOKEN" and "END_TOKEN", and
pipe it to standard output.

thanks.

 
Reply With Quote
 
 
 
 
AbhiSawa
Guest
Posts: n/a
 
      07-19-2006

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> hi
>
> how to extract multi-line text from a text file looking like this:
> #!/bin/bash
>
> ...
>
> BEGIN_TOKEN
> multi-line text 1
> ......
> ......
> END_TOKEN
>
> BEGIN_TOKEN
> multi-line text 2
> ......
> ......
> END_TOKEN
>
> BEGIN_TOKEN
> multi-line text 3
> ......
> ......
> END_TOKEN
>
> I need to extract all text between "BEGIN_TOKEN" and "END_TOKEN", and
> pipe it to standard output.
>
> thanks.



One more small fish

perl -ne 'print if /^BEGIN_TOKEN$/ .. /^END_TOKEN$/' filename


AbhiSawa

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Please help me how is easiest way to extract text between some variable text Mladen Perl Misc 5 02-22-2011 10:57 AM
How do i extract vidios when winrar wont extract them??? help plzzzzzzzz smuttdog@sc.rr.com Computer Support 2 12-23-2007 07:03 AM
Extract text to html href (a bit long) text news Java 1 08-23-2003 09:54 AM
extract strings between alternating text Lydia Shawn Perl 2 08-10-2003 10:01 AM



Advertisments