この sed 式は、入力文字列を 2 行の出力文字列に変換します。2 つの出力行はそれぞれ、入力の部分文字列で構成されます。最初の行は大文字に変換する必要があります。
s:random_stuff\(choice1\|choice2\){\([^}]*\)}:\U\1\n\2:
目的は変換することです
random_stuff_choice1{This is a sentence that MAY contain AnyThing}
random_stuff_choice2{This is another similar sentence}
の中へ
CHOICE1
This is a sentence that MAY contain AnyThing
CHOICE2
This is another similar sentence
私が抱えている問題は、\U がそれに続くすべてのものに適用されるため、2 行目も大文字になることです。\U を最初の一致のみに適用することは可能ですか?