sed magic

Hello all,

I have an inherited an old ugly script I'm trying to clean up a bit.
What I am currently working on is a line like the following:

Complication=" and ta.secID  = 011222 and upper(ta.proc_ctrl_no) != 'IMPACT'";;

I just want to combine a search for lines that begin with Complication
and then remove the double ";;" at the end of those lines.

There are other case blocks in the script, so I don't want to just remove them from any line. I have tried various combinations using \1 but I seem to keep grabbing the entire line.
Is there a way to say search for lines beginning with ___ AND remove the last two characters? I can do each separately, but I can't figure out how to combine them.

Any hints would be greatly appreciated.

Thanks

Does this do what you'd like?

sed -e '/Complication=.*;;$/!b'  -e 's/;;$//' input-file >output-file

If the line isn't Complication= with two semicolons at the end, it just prints the line; otherwise it strips the trailing semis.

or:

sed '/Complication=.*;;$/s/..$//' infile

or

sed '/\(Complication=.*\);;$/\1/'  infile

@Agama
Unfortunately that did not work.

@Scrutinizer
I had already tried both of those, (Tried yours too just in case), but neither of those work.

I think I may just get rid of any lines ending with a '";;' then I will only have to fix 15 lines. That's not too bad.

Are you certain your input file is not in DOS format?
Do you see \r 's when you do:

head infile | od -c

Otherwise, what is your OS and version?

could u plz try this .....

sed -n '/^Complication/s/..$//p' input