grep all lines from PATTERN1 to PATTERN2

Hi!

From a file like this one :

hello
...
PATTERN1
...
lines between patterns
..
PATTERN2
... 

I would like to extract only the lines between patterns, probably with awk I think?

Thanks a lot for your help,

Tipi

Some possibilities:

sed -n '/PATTERN1/,/PATTERN2/p' file
awk '/PATTERN1/{f=1}/PATTERN2/{f=0;print}f' file

Regards

Thanks!

Can we modify it so that patterns dont appear in the output?

Thanks again!

awk '/PATTERN1/{f=1;next}/PATTERN2/{exit}f' file

Very appreciated!