I am trying to to print any text that exists between two different patterns also with this patterns. But only when text between patterns containing particular string [using awk, flag...].
My input file:
START 12.5 elephant dasnbjdai adfad
s = ad cat da 524a das
da 54e dog dada 455ad7
da 45d cow 554s7e
END
START fjs 4 rhino das 452 da
da = cat da gd
das_d pig das
4524s dda monkey dasdc4
END
START da dfsdg cow
bear dac45
lion bla bla
5as4 fox bla fa jsa
END
START dandsk cow dada
bla sheep bla
fsgv turtle fsd
da dragon da
END
START
daadas pig fsv45
dasd walrus das 52
END
and my output should be [just show lines between START...END, but containing cat]
START 12.5 elephant dasnbjdai adfad
s = ad **cat** da 524a das
da 54e dog dada 455ad7
da 45d cow 554s7e
END
START fjs 4 rhino das 452 da
da = **cat** da gd
das_d pig das
4524s dda monkey dasdc4
END
How can I print i.e all lines containig dragon and walrus;
Output
START dandsk cow dada
bla sheep bla
fsgv turtle fsd
da dragon da
END
START
daadas pig fsv45
dasd walrus das 52
END