Say I have a text containing the words red and blue.
How do I replace occurences of the word blue with the word green only in all lines containing the word red?
Likewise how can I replace blue with green in all lines NOT containing the word red?
To replace “blue” with “green” in lines that contain “red”:
To do the replacement in lines that do not contain “red”: