Q:

How to use sed or awk for editing really long Java class

I am implementing a Decorator pattern for the class which has a lot of methods. I created this Decorator class and just put all the methods that should be here. 
Now I have a class with 2000 lines where every part like:
@Override
public String getCapadCode()
{
    return null;
}

should be replaced with:
@Override
public String getCapadCode()
{
    return origin.getCapadCode();
}

Is it possible to somehow automate this process with sed or awk?

A:

you can use search and replace with regular expression like this:
search:
get(.*)\(\)\R\{\R    return null;\R\}
replace:
get$1\(\)\R\{\R    return origin\.$1;\R\}
I use Eclipse Find/Replace for that.

