How to? Have hammer - every problem is a nail???

Mar 17, 2013
11
0
How is TCC & TCC/LE for text file processing? I am just relearning this from 4dos days.

We all tend to have our favorite tools and when you like hammers every thing gets nailed down. I wonder if this new and shiny TCC is appropriate for this kind of work. I have a text file that will be coming automatically from a TCC directory listing, that needs some other text added to each line as follows:
Code:
From:
 
S:\Pix2012\2012-01 Jan\[2012-01-27] Shaw, Danielle
S:\Pix2012\2012-01 Jan\[2012-01-28] Bruno, Giovanni
to
 
"S:\Pix2012\2012-01 Jan\[2012-01-27] Shaw, Danielle", Tami, 20120316
"S:\Pix2012\2012-01 Jan\[2012-01-28] Bruno, Giovanni", Tami, 20120316
and then the listing will be imported into a sqlite database. Can TCC be used for this? What about TCC/LE since I will need to run this on numerous workstations??

Is now a good time to better learn TCC??
 
Mar 17, 2013
11
0
Code:
for /f "tokens=*" %a in (filelistB.txt) echo "%a", Tami, 20120318
Seems to work. Like greek, it comes back slowly.... (too many years without 4dos :-)
 
Jun 24, 2008
223
0
Siegen, Germany
Personally, I wouldn't use CMD or TCC for this. They suffer from a lot of problems when it comes to quoting.
I think you're better off using a tool like sed, perl or JavaScript.

Greetings
 
Nov 13, 2008
255
3
www.thedave.me
Unfortunately I'm with nickles here, everything will work fine until you hit a random "Jack & Jill" when you only ever expected "Jack and Jill". You can use SETDOS and hobble yourself to the point of TCC being useless, or use safechars plugin to mitigate some (but not quite all) of the risk.

Sadly a lot of problems that look very easy in TCC simply aren't, whereas they turn out to be trivial in languages that don't interpret variable content as part of the command being interpreted.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Sadly a lot of problems that look very easy in TCC simply aren't, whereas they turn out to be trivial in languages that don't interpret variable content as part of the command being interpreted.
Yes, the need to retain compatibility with CMD.EXE requires that, and is the root cause of the need for SETDOS/X, the variety of quoting requirements, and a great deal of otherwise unnecessary complexity in the the parser.

Quite a while back for many years I had suggested a separate class of data variables, which are not environment variables, as is done in some of the Unix shells, IIRC both Korn-shell and C-shell, using "a=b" vs. "set a=b" for assignment, to be used in the manner of compiled HLLs - strongly typed with fixed rules for internal representation, for methods of conversion between internal and external representation, for assignment, deferred v. instant evaluation (during command execution v. parsing). The closest we have is the binary buffer, which requires the user to write all the functions for mapping variables to buffers, assignment, conversion, etc. - virtually rewrite BASIC in TCC.
 
Jun 24, 2008
223
0
Siegen, Germany
Another question: Why not leave the trails of CMD and move on to another - better - command shell with the best features of all "worlds", a [better] working command line completion (I'd love to use grep w/o any SETDOS tricks), a connection to cmdlets (w/o the stupid syntax of PowerShell), etc.

I have stopped using CMD a long while ago (except for the cases/environments where it is absolutely mandatory), and wouldn't have any problems with a new "language" to learn. I personally don't need CMD compatibility, I need a good shell (which TCC mostly is)...
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Code:
for /f "tokens=*" %a in (filelistB.txt) echo "%a", Tami, 20120318

Actually, I'd rather use the DO with the "@file" syntax:
do line in @filelistB.txt (echo "%line", Tami, 20120318)


This can even be redirected so that the target file is opened and closed only once:
( do line in @filelistB.txt (echo "%line", Tami, 20120318) ) > target.file

However, this is still subject to characters in the data line being interpreted as syntactically significant. Charles Dye's SafeChars.DLL can help:
( do line in @filelistB.txt (echo "%@safeenv[line]", Tami, 20120318) ) > target.file

Watch the peculiar syntax of the @SAFE... functions: to circumvent the TCC parser's overzealousness, the parameter is NOT preceded by the percent sign "%"!
 
Similar threads
Thread starter Title Forum Replies Date
kb6ojs Want to start TCMD v20 with every Windows 10 bootup Support 3
vefatica IDE crashes every time Support 6
WadeHatler Just started getting a message about Cloud Storage every time I start TCC 19 Support 3
Dick Johnson Weird Color Problem Support 8
fishman@panix.com Problem with 27.15 Support 2
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
R Problem with @INT[ value] in V26 Support 9
M Selecting test "off by one" problem in Take command Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
K_Meinhard Small problem in german IDE 26 Support 3
B Problem with color in nested shells Support 1
Joe Caverly Problem creating and switching to a DESKTOP Support 9
vefatica Another popup problem Support 10
Alpengreis ffind dialog (/W) problem Support 4
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
A Problem with functions @int @decimal and identifying Powershell as a shell. Support 12
B IF command problem in tcexit.btm Support 9
fishman@panix.com Problem at Startup of TCC Support 3
P Problem with SFTP copies Support 7
P Problem with FTP copies Support 10
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
R Problem with %_do_loop in nested do loops Support 2
fishman@panix.com New Problem with later Windows 10 Support 10
Peter Murschall A little problem with LEAVE and COMMENT Support 5
M Handling of %~I problem Support 4
WinLanEm FOR problem Support 18
K Problem With SCRPUT /u Support 3
vefatica What's TCMD's problem with ^e[0m? Support 13
Peter Murschall IDE: RTL with non-English resources-problem is back in Build 28 Support 4
rps Regex problem: \xnn not recognized as a hex character Support 0
rps PRIORITY LOW problem Support 1
old coot Regex problem: \xnn not recognized as a hex character Support 12
vefatica Another problem with build 22. Support 3
Alpengreis [23.x] Download-Problem Support 2
S Problem with " Support 3
C Problem navigating forums Support 11
x13 Problem listing repository files using DIR http(s)://... Support 8
Joe Caverly Problem with TEE in v22 Support 2
Alpengreis Problem with thousands delimiter and colors Support 17
M Take Command 18, migrating to another machine, license problem. Support 1
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? @search problem Support 2
WinLanEm @SELECT problem Support 6
T Fixed Problem with use of Batch parameters in the IDE Support 1
Oz Solomon Problem with "list" Support 14
S V21.24 theme problem Support 2
Alpengreis Problem if command prompt is not legacy Support 4
Alpengreis TCMD.INI: The "super hidden" problem ... Support 6
G Odd problem - screen brightness Support 4

Similar threads