My file contains:
Pineapple Apple Banana Rice Grape Watermelon Orange Apple Banana Rice Mango Pear Plum Banana Rice Cherry
I want to make it like this:
Pineapple Apple Banana Rice Grape Watermelon Orange Apple Banana Olive Mango Pear Plum Banana Rice Cherry
I am, here, changing from "Rice" to "Olive", but only where the occurrence of "Rice" follows a match of a multi-line pattern; specifically where "Rice" occurs after the multi-line pattern:
Orange Apple Banana
I am open to using awk
, perl
, sed
, or any other tool.