how to find last occurrence of a pattern file code example
Example: how to find last occurrence of a pattern file
tac < fileName | sed '/EndPattern/,$!d;/StartPattern/q' | tac
tac < fileName | sed '/EndPattern/,$!d;/StartPattern/q' | tac