Need to find a multiple line block and replace with a multiple line block

I would perfer to use cut and paste to do this but I can't find a GUI to do this with. What I want to do is to find a multiple line block of code like

Exit Sub

Log_Handler:

then replace it with

GoTo RSLogRtn
Exit Sub

Log_Handler:

Basically it is just an insert, but I may want to replace whole line blocks of code at some time. How can this be accomplished. I tried using V-Grep but to no avail. It will only replace the line block with a string and you can't use expressions in the replace test.

can you elaborate more by giving your exact inputfile and desired output.

It's all there in the post...

Input: Text
OutPut: Text
Desire: Change from first text to second text...

Try this then...

>cat file
Exit Sub
 
Log_Handler:
 
>awk '/Exit/{err=$0;getline;getline;if($0 ~ /Log_Handler:/){print "GoTo RSLogRtn" RS err RS RS $0}}' file
GoTo RSLogRtn
Exit Sub
 
Log_Handler:

I will try it. Does this find/replace every reference in the file?

yes, if it is the same as your example. And if that's how you wanted it, redirect to another file.

Yes, to redirect the whole contents with the changes to another file.

---------- Post updated at 11:42 PM ---------- Previous update was at 11:37 PM ----------

Ok, now I have to find a version of AWK or GAWK that works in Windows.

Thanks.

what is RS err RS RS $0) here Please explian.

Thanks in advace

RS is for input record separator which is new line character by default.
$0 is to for all fields.
err is just a variable that assigned the value of $0.

For more information ....read

man awk