I have files like this:
class SomeClass
extends anotherClass
with moreClassA
with moreClassB {
//do some crazy stuff
}
I'd like to add one more class to it like this:
class SomeClass
extends anotherClass
with moreClassA
with moreClassB
with oneMoreClassIwant {
//do some crazy stuff
}
I tried to use sed for replacing like this:
sed -E "s/(Class SomeClass[A-Za-z \n]+)\\{/\1with OneMoreClassIWant/" tmp.scala
but it doesn't work for multi-line matching.
I also noticed an example from this post but failed to adapt it to my case.
sed
seems like a complication. This would be somewhat more comfortable in Awk, and pretty straightforward in Perl, where nonstandardsed
things like-z
are actually reasonably standard if you have Perl in the first place.