Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Literal tab character

Jun
223
0
How would I accomplish the following in TCC (taken from bash)?

Code:
sqlite3 --separator '${\t}' SOME_DATABASE < SOME_SCRIPT
The problem is the translation of '${\t}' which is required to result in the a LITERAL (0x9) tab character embedded in single quotes. In a first (naive?) attempt I tried to translate this into:

Code:
sqlite3 --separator '^t' ...
which - according to the help file should result in a literal tab character being inserted for ^t. As you will guess, this failed (like other attempts using "^t", `^t`, etc).

nickles
 
^T works for me, inserting a tab character in the command line.

Is it possible the Windows port of your program is actually expecting a \T combination?
 
Hi Charles,

please try the following:

sqlite3 -separator 'x' "%FIX%\cookies.sqlite" "SELECT host FROM moz_cookies LIMIT 1;"
works, separator is 'x'; but

sqlite3 -separator '^t' "%FIX%\cookies.sqlite" "SELECT host FROM moz_cookies LIMIT 1;"
results in

sqlite3: Error: too many options: "SELECT host FROM moz_cookies LIMIT 1;"
Use -help for a list of options.
nickles
 
Either way, it's an unknown command on my system. But if I

Code:
echo sqlite3 -separator '^t' | list /x

then I do see the 09 in the output.

Have you tried just passing \T ?
 
Hi Charles,

it indeed seems to be a problem with the console or sqlite3 itself. Tried the command from a batch file (verifying that there really was a 0x9 between the single quotes) and it didn't work neither from cmd.exe nor from tcc.exe! Weird...

Thanks for your help!

nickles
 
How about ...
Code:
sqlite3 -separator '^^t' "%FIX%\cookies.sqlite" "SELECT host FROM moz_cookies LIMIT 1;"
 
The parsing for the shell does this to parse the separator command line
switch:

}else if( strcmp(z,"-separator")==0 ){
i++;
if(i>=argc){
fprintf(stderr,"%s: Error: missing argument for option: %s\n",
Argv0, z);
fprintf(stderr,"Use -help for a list of options.\n");
return 1;
}
sqlite3_snprintf(sizeof(data.separator), data.separator,
"%.*s",(int)sizeof(data.separator)-1,argv);

-Scott

nickles <> wrote on 10/27/2011 04:15:54 PM:


> Hi Charles,
>
> it indeed seems to be a problem with the console or sqlite3 itself.
> Tried the command from a batch file (verifying that there really was
> a 0x9 between the single quotes) and it didn't work neither from
> cmd.exe nor from tcc.exe! Weird...
>
> Thanks for your help!
>
> nickles
>
>
 
What happens if you put the tab char in double quotes?

-Scott

samintz <> wrote on 10/27/2011 05:15:10 PM:

>
> The parsing for the shell does this to parse the separator command line
> switch:
>
> }else if( strcmp(z,"-separator")==0 ){
> i++;
> if(i>=argc){
> fprintf(stderr,"%s: Error: missing argument for option: %s\n",
> Argv0, z);
> fprintf(stderr,"Use -help for a list of options.\n");
> return 1;
> }
> sqlite3_snprintf(sizeof(data.separator), data.separator,
> "%.*s",(int)sizeof(data.separator)-1,argv);
>
> -Scott
>
> nickles <> wrote on 10/27/2011 04:15:54 PM:
>



> Quote:
>
> > Hi Charles,
> >
> > it indeed seems to be a problem with the console or sqlite3 itself.
> > Tried the command from a batch file (verifying that there really was
> > a 0x9 between the single quotes) and it didn't work neither from
> > cmd.exe nor from tcc.exe! Weird...
> >
> > Thanks for your help!
> >
> > nickles
> >
> >
>
>
>
 
I haven't followed this thread carefully. Have you tried %@CHAR[9] on the
command line? ... or **really** put a TAB there with Alt-0255 followed by the
tab key?
 
Hi samintz,

the following works:(!)

sqlite3 -separator "literal_tab_as_pasted_from_an_editor" ...

These do not:

sqlite3 -separator "^t" ...
sqlite3 -separator "\t" ...
sqlite3 -separator 'literal...' ...
sqlite3 -separator `literal...` ...

Thanks!

nickles
 
@vefatica

Sorry, overread your answer.

The following also works:

sqlite3 -separator "%@char[9]" ...

Interestingly ... "^t" doesn't work though it's supposed to according to the docs.

Thanks!

nickles
 
I suspect then, that Vince's suggestion of using "%@char[9]" would work as
well as the literal tab suggestion with Alt-0255<TAB>

-Scott



Hi samintz,

the following works!)

sqlite3 -separator "literal_tab_as_pasted_from_an_editor" ...

These do not:

sqlite3 -separator "^t" ...
sqlite3 -separator "\t" ...
sqlite3 -separator 'literal...' ...
sqlite3 -separator `literal...` ...

Thanks!

nickles
 
On Thu, 27 Oct 2011 17:47:02 -0400, nickles <> wrote:

|Interestingly ... "^t" doesn't work though it's supposed to according to the docs.

Although TCC "recognizes" ^t (et al. (help)) I don't think it would be wise to
translate it in the args to other EXEs. The caret has a special meaning to many
text utilities accepting regular expressions.
 
Although TCC "recognizes" ^t (et al. (help)) I don't think it would be wise to translate it in the args to other EXEs. The caret has a special meaning to many text utilities accepting regular expressions.

Expansion of escape characters is done long before the external program is launched. I think the real issue is that it doesn't happen between double quotes -- I don't know why not, but there's probably some good reason.
 
> Expansion of escape characters is done long before the external program
> is launched. I think the real issue is that it doesn't happen between
> double quotes -- I don't know why not, but there's probably some good
> reason.

Whenever something doesn't make sense, it's a pretty good bet that the
reason is "CMD compatibility".

And so it is with this one.
 
On Fri, Oct 28, 2011 at 2:48 PM, rconn <> wrote:

> ---Quote (Originally by nikbackm)---
> :)
> What is CMD's excuse then?
>
> Maybe COMMAND.COM compability?
> ---End Quote---
> There was a time when I tried to divine the intention behind CMD's syntax. *But it made it dazed, confused, and ... uhhh ... what was I saying?

I just assume that very few Windows users use CMD, so it has a low
priority in MS, and gets assigned to the less experienced developers.
A lot of the additions to NT CMD looked like a response to what you
introduced in 4DOS. But the syntax feels a lot like hanging a bag on
the side of the box, because doing it right is more trouble than they
felt like taking.


> Rex Conn
_____
Dennis
 
What is CMD's excuse then?

Maybe COMMAND.COM compability?

No; COMMAND.COM never had escapes.

Perhaps the idea was that double-quotes are often used around filenames, and a filename is more likely to contain a caret than a control character -- though either one sounds like a Bad Plan to me.
 
On Fri, 28 Oct 2011 15:25:28 -0400, Charles Dye <> wrote:

|Perhaps the idea was that double-quotes are often used around filenames, and a filename is more likely to contain a caret than a control character -- though either one sounds like a Bad Plan to me.

Isn't it simply not wanting to mess with the arguments a user wants to give to
another EXE. How could you use a regular expression (grep, sed, ...) containing
the common and useful "[^t]" if some command interpreter were turning it into
something else?
 
Isn't it simply not wanting to mess with the arguments a user wants to give to another EXE. How could you use a regular expression (grep, sed, ...) containing the common and useful "[^t]" if some command interpreter were turning it into something else?

I think you're right; that makes more sense than my theory.
 

Similar threads

Back
Top