Processing CSV file, hit = char and stops

ron

Aug 19, 2008
146
0
#1
I'm guessing the '=' char is the culprit.

Just doing fileread in a do/while and today discovered it stopped prematurely. Guessing the '=' in the line it didn't process is the cause.

So, trial and error,

setdos /x-3
fileread
setdox /x0

gets around that problem.

So I'd like for the read to ignore (not interpret/process) any of the file content. Is there a single switch for that?

Fortunately @word can process the string now but if I try to echo it for debugging purposes, the batch file stops. Wrapping setdos around the echo doesn't work.

setdos /x-3
echo %lineread
setdox /x0
 
Last edited:
#3
You might try using more flags with SETODS. The CHM for SETDOS says:

For example, to disable all features except alias expansion while you are processing a text file containing special characters:

setdos /x-35678

... [perform text processing here]

setdos /x0
 

ron

Aug 19, 2008
146
0
#5
yeah, saw the plugin reference during a search - I might try that but I wanted minimal dependency and just native TCC.

I'll try to assemble a simple test with script/data. There were no errors. Just when it hit the line with =, the script acted as though it had hit EOF.

I'd used TCC plenty of times to parse text files before and that's all I was looking to do. Just didn't know that it was apparently interpreting the chars read in and acting on them rather than just storing them as-is in a variable. Cool that you can do extra stuff with properly formatted text in a file but right now I just want to read, match a word in a column, and count++.

I just tried setdos /x-123456789 and that got me past line 70 to line 576 of 1149.

---hang on 35678 might have helped.....checking.....

nah, darn it. setdos is a ghost. fileread in two places. setdos wrapped around each. with setdos wrapped around the initial fileread 24 lines processed. comment that out and leave only the setdos in the do-while, 385 lines read. Sample data/script will probably be the only way to sort this out.
 
Last edited:
#6
same thing happens if you have a folder named "C:\Program Files (x86)\Eltima Software\SWF & FLV Player" and do a pdir /(fpn). TCC interprets the "&"
 

ron

Aug 19, 2008
146
0
#8
Yes, sorry, meant to imply @FILEREAD.

So, that's great to hear - that READING should not be an issue.

I've simplified the original script/data such that I could still repro the issue.

Script/data attached and a video illustrating the test.
 

Attachments

rconn

Administrator
Staff member
May 14, 2008
10,749
97
#9
I've simplified the original script/data such that I could still repro the issue.

Script/data attached and a video illustrating the test.
The problem is with your DO comparison - your lines have embedded ='s (so DO doesn't know the comparison you want), and multiple double quotes (so DO doesn't know which is the first argument and which is the second.

You can work around it with something like this:

do while (%xdata) != (**EOF**)
 
Likes: ron

ron

Aug 19, 2008
146
0
#10
I started with an old batch file where I was parsing some simpler data from long ago. Don't recall why I was using quotes back then.

THANK YOU!!!