If it's just that one line, you could say
sed 's/)$/, cascade = CascadeType.All)/'
to insert , cascade = CascadeType.All)
before the closing regex ($
matches the end of the line here).
I suspect, though, that you have a file in which there are more lines that should remain unchanged, and that you want the substitution to happen only in this line. In this event, you'll need some criterium that uniquely identifies the line -- most commonly a regex. If, for example, this is the only line that begins with @OneToMany(
, you could use
sed '/^@OneToMany(/ s/)$/, cascade = CascadeType.All)/'
This will instruct sed
to attempt the substitution only if the current line matches the regex ^@OneToMany(
. If there are other lines that begin this way and should remain untouched, find a regex that uniquely identifies the line and use it instead.