I am trying to search for last occurrence of the pattern in the file and delete everything after the line containing last pattern. I wonder if its possible using awk or sed. thanks in Advance.
aaaaaa bbbbb cccccc
aaaaaa pattern dddddd
eeeeee fffff gggg
qqqq eeee rrrr
desired output:
aaaaaa bbbbb cccccc
aaaaaa pattern dddddd