Replacing all except for the matching pattern

Hi all

I need to replace all characters in a file except for the matching pattern

eg.

I need to replace all character with '*' except for the pattern "abc"

Input
"sdfhgsdf abc ##%$#abcsdfh sdfjkfff"

Output
"******abc******abc*************"

Request for single liner solution

In vi/vim:

:g/abc/s//[Control-V][Control-\]/g
:g/[^[Control-V][Control-\]]/\*/g
:g/[Control-V][Control-\]/s//abc/g

I'm using [Control-V][Control-\] to replace 'abc' pattern with 034 octal character. Then replace all other characters with '*' (or something else) and then replace 034 octal character back to 'abc' again. You can use any other character instead of octal 034, e.g. '@' but this character must not occur in the file. If this is the case, then the same procedure beomes easier:

:g/abc/s//@/g
:g/[^@]/s//*/g
:g/@/s//abc/g

You can, of course, map this procedure to a single keystroke (map command in vi/vim) to get this one-liner of yours.