How to add text to end of line when pattern is matched?

inputs:

line1 with the PATTERN that contains ( ) 
line2 with the PATTERN that contains ( ) 
lineN with the PATTERN that contains ( ) 

outputs:

line1 with the PATTERN that contains ( ) ;
line2 with the PATTERN that contains ( ) ;
...
lineN with the PATTERN that contains ( ) ;

I tried this:

find . -name "test.txt" -print | xargs sed -i "/PATTERN/ s/$)/); /g"

but it didn’t work.

Leave a Reply

Your email address will not be published. Required fields are marked *