Literal tab character

Jun 24, 2008
223
0
Siegen, Germany
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
 
Jun 24, 2008
223
0
Siegen, Germany
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
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
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 ?
 
Jun 24, 2008
223
0
Siegen, Germany
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
 
Jan 19, 2011
604
14
Norman, OK
How about ...
Code:
sqlite3 -separator '^^t' "%FIX%\cookies.sqlite" "SELECT host FROM moz_cookies LIMIT 1;"
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
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
>
>
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
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
> >
> >
>
>
>
 
May 20, 2008
11,411
99
Syracuse, NY, USA
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?
 
Jun 24, 2008
223
0
Siegen, Germany
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
 
Jun 24, 2008
223
0
Siegen, Germany
@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
 

samintz

Scott Mintz
May 20, 2008
1,503
16
Solon, OH, USA
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
 
May 20, 2008
11,411
99
Syracuse, NY, USA
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.
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
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.
 

rconn

Administrator
Staff member
May 14, 2008
12,356
150
> 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.
 
May 30, 2008
235
2
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.

:)

What is CMD's excuse then?

Maybe COMMAND.COM compability?
 
Jun 7, 2008
101
5
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
 
May 20, 2008
11,411
99
Syracuse, NY, USA
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?
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,466
88
Albuquerque, NM
prospero.unm.edu
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
Thread starter Title Forum Replies Date
vefatica Literal double quotes in SHORTCUT's "args" parameter? Support 6
vefatica WAD "tokens=*" and literal string Support 4
vefatica Tab (^t) in @FILEWRITE's text Support 2
D TCC tab detaching & restarting Support 3
Joe Caverly Changing the TAB key Support 10
fpefpe bash.exe as a tab Support 0
C How to? Mouse support in WSL when in Take Command Tab Support 2
P How to enable \ with tab completion Support 4
Joe Caverly DrawVLine results different in TCMD tab and detached TCC Support 11
Joe Caverly Tab from clipboard Support 6
Joe Caverly Clone a TCC Tab Support 9
R New Cloud Storage Tab in TCC options causing problems Support 0
CWBillow PowerShell tab as Admin Support 2
vefatica TYPE resets console tab settings Support 14
CWBillow TCMD PowerShell Tab elevated Support 6
CWBillow Take Command tab as PowerShell Support 3
Fross Tab Question Support 6
CWBillow TCMD Tab Defs Support 4
L WAD In console, tabs are rendered with non-uniform tab-stop spacing Support 16
Emilio III TCMD Tab titles on Insider Windows Support 2
P Run as Admin tab in non-elevated Take Command session? Support 9
CWBillow Powershell tab in TCMD? Support 2
Phileosophos Startup tab layout Support 2
M How to? How to set a default TITLE for newly opened tab? Support 2
R How to? Change TCMD tab font size in window menu Support 3
D Get tab position and size Support 6
C Running PowerShell_ISE in a Tab Support 7
D How cut in TCC tab window Support 5
C How to? run a BTM in elevated, inv tcc tab window Support 9
D Take Command tab only uses half of window Support 1
rps Tab clone problem Support 2
C MONITOR commands alter tab title when triggered Support 0
D Tab completion differences with cmd.exe Support 3
H lua Causes Take Command Tab to Exit Support 5
vefatica Tab completion? Support 4
D How to? How to show variables expanded in the log tab Support 3
I tab completion with directory commands Support 7
R Fixed v17.0.54 Tab->COMSPEC Dialog Box Issue Support 2
vefatica Fixed Crash removing toolbar tab Support 1
I v16 Spawning a PowerShell tab Support 3
Jay Sage Getting Quote Characters into a Toolbar Tab Support 12
Jay Sage "New Tab" Strangeness Support 2
rps Command Input Window tab completion broken Support 7
David Wilbanks How to make new tab open in same directory as previous tab? Support 4
tmaynard How to? Any way to run a command in a new tab at startup? Support 18
A How to? Frozen session tab with "ERROR: The file is either empty or does not contain the valid choices." Support 19
W Opening a new tab takes forever to get the command prompt Support 5
Joe Caverly VIEW window in a TCC tab window problems Support 5
B WAD tab navigation broken Support 3
D Console window titles / tab caption Support 4

Similar threads