how to extract multi-line text

P

perltcl

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.
 
A

AbhiSawa

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top