模式匹配时如何将文本添加到行尾?

use*_*338 8 shell sed line-editor

输入:

line1 with the PATTERN that contains ( ) 
line2 with the PATTERN that contains ( ) 
lineN with the PATTERN that contains ( ) 
Run Code Online (Sandbox Code Playgroud)

输出:

line1 with the PATTERN that contains ( ) ;
line2 with the PATTERN that contains ( ) ;
...
lineN with the PATTERN that contains ( ) ;
Run Code Online (Sandbox Code Playgroud)

我试过这个:

find . -name "test.txt" -print | xargs sed -i "/PATTERN/ s/$)/); /g"
Run Code Online (Sandbox Code Playgroud)

但它没有用。

Dop*_*oti 0

尝试:

sed --in-place '/PATTERN/s/.*/&;/' /path/to/file.txt
Run Code Online (Sandbox Code Playgroud)