Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
- MatchText_randomNumberOfText moreData ReplaceMe moreData
- MatchText_randomNumberOfText moreData moreData ReplaceMe moreData moreData
- MatchText_randomNumberOfText moreData ReplaceMe moreData moreData
- TextTextText_randomNumberOfText moreData ReplaceMe moreData moreData
The above is an example of four lines. I want to find all the lines containing "MatchText" (lines 1,2 and 3) and replace the "ReplaceMe" in that line with "REPLACED".
"ReplaceMe" occurs multiple times in lines I do not want to replace it in (as in line 4 above)
Hope that makes sense!!
Many thanks