sed imbed a tab

I'm using OpenBSD 4.3 & ksh (pdksh) default shell.
I'm trying to use sed to insert a tab into a text file with no luck.

$ sed 's/SusanAppleton/Susan\o011Appleton/' myFile.txt
Susano011Appleton
$ sed 's/SusanAppleton/Susan\tAppleton/' myFile.txt
SusantAppleton

I'm close to suicide here. Please help :frowning:

Have you tried just using the tab key to enter the character in your sed script?

I tried that. However, when I hit the tab key, the PC speaker just beeps and the cursor stays where it was.

How weird.... is that when you're in vi? Or on the command-line? Or everywhere?

How about using perl instead:

perl -pe 's/SusanAppleton/Susan\tAppleton/' myFile.txt > myFile_modified.txt

The tab key will beep the PC speaker when I try to use it in a command (however, tab completion works, oddly enough). When I'm using ed or vi, the tab key functions as expected (it inserts 0x09). I could definitely use perl, but I'd like to know why OpenBSD sed isn't working for me here. It's driving me crazy. GNU sed will allow \t \n etc...

Oh, try Ctrl-V followed by the tab key.

You could try typing...

ctrl-v ctrl-i

..for the tab character. I find this works.

Got once this from PHV (tek-tips):

VAR="\t"
echo "SusanAppleton"| sed 's/A/'${VAR}A'/g'
Susan   Appleton

Wow! That worked! What does Ctrl-V mean/do????
And thank you, everyone! :b:

Ctrl-V means to interpret the next character entered literally, i.e. not attempt to perform any special functions such as tab-completion.