Add line after AND before two patterns like patch do

view story

http://www.unix.com – Hi all, I kwow there are many ways to insert string into a files all over the forum, but I need to make that process like patch do because in the same file I can have the same pattern in many locations, for that I need the send two patterns, one for "before" and another for the "after". I cannot be capable to do it with patch and diff because the original file to be patched can be modified by other scripts after doing the patch file with diff. So that is the example: I have "file" with that content: Code: hello hello second hello patern hello hello pattern (HowTos)