I'm guessing that bash's built-in echo command isn't treating \007 the way you'd like. I personally find that echo varies so widely between systems/shells that I avoid using it at all possible costs. I also do not advocate breaking a sed string to "insert" shell generated text -- hard to maintain in my humble opnion.
If I were doing it, I'd tackle it this way as it should work regardless of shell:
This is a real hack, but I cannot think of anything else to try without having a Sun to run the test on myself. Try this, but see the note below before you change your script:
The ^G is a control character entered using an editor, NOT the two characters ^ and G as appear here. Using vi to edit the script, and while in insert mode, type CTL-V and CTL-G to insert a control-g character into the file. You should see ^G reprented by vi. I'm not a fan of putting control characters into a script like this, but if it's the only way then one does what works.
If this doesn't work, then I'm out of suggestions. Hoping for the best, and sorry if you're left with it broken.
You have a space there between single quote and backtick. That causes error -- sed complains about unterminated s command. There is no need for echo or escaping quotes or comma.
Try this:
sed 's/","\*\*/\x07/' filename > filename2
And check with 'od':
$ echo '"blah","**ddsa","das**","dad"' | sed 's/","\*\*/\x07/'
"blahddsa","das**","dad"
$ echo '"blah","**ddsa","das**","dad"' | sed 's/","\*\*/\x07/' | od -c
0000000 " b l a h \a d d s a " , " d a s
0000020 * * " , " d a d " \n
0000032
$ echo '"blah","**ddsa","das**","dad"' | sed 's/","\*\*/\x07/' | od -x
0000000 6222 616c 0768 6464 6173 2c22 6422 7361
0000020 2a2a 2c22 6422 6461 0a22
0000032
You can insert a control character with crtl-v on the command line, no need to save it and use vi:
Thanks -- I read the man page and found no reference to being able to use \xXX. I tried \0xXX which didn't work and am glad to be able to take something new away from this thread.
True. I omitted that as the OP indicated it wasn't working from a script.