Click to See Complete Forum and Search --> : Writing To Tab Delemeted Files


LiveWire63
12-11-2002, 08:17 PM
A am writing a very basic script for a contact DB. It only has four fields and I am nearly done with my coding. I did, however, run into a slight problem with my add function. I can get it to add the users input to the file, but it wont tab it. Everywhere I look it tells me to use quotes (""). This would make the code look something like:

echo "$VAR1 [Tab] $VAR2 [Tab] $VAR3 [Tab] $VAR4" >> contact.txt

Where [Tab] = the tab key and contact.txt = the DB file.

This writes to the file, but it replaces the tabs with regular spaces. This causes a problem with recognition in my later code (as the file is no longer tab delemeted).

I've tried many different variations, including using /t and other variations of quoting. Like I said, it a very simple program and I feel really stupid about asing such an easy question. I wouldn't ask normally but I've hit a wall here. Thanks in advance for any help.

EscapeCharacter
12-11-2002, 08:38 PM
that should be \t not /t and you need to add the -e option to echo for escape sequences


echo -e "\t"

LiveWire63
12-12-2002, 03:48 AM
Worked Perfectly, Thanks So Much!