how to append the pattern at the end of the line

-Hi
I have multiple files which contain a line with the word "exec". I need to add the following pattern " -cmode -ccheap" on the same line where "exec" is at the end. Any idea? Thanks a lot in advance to everybody... -A

 sed 's/.*exec .*/& -cmode -ccheap/' somefile > newfile

try that

Thanks a lot