I have a file which contains...CNN111XXXABC111XXXABC111BBC...and I need to change the 111 to 999 but only as part of ABC\n111\nXXX ...CNN111XXXABC999XXXABC111BBC...I have tried this, but it changes 111 everywhere.perl -i -pe '/ABC\n111\nXXX/ if s/111/999/g' FILENote: We need to compare multiple lines as 111 might be in many other places. The file size is 227kb.
Using perl to change multi-line expression
perl