WAD TPIPE /SPLIT makes extra 0-byte file

May 20, 2008
11,530
102
Syracuse, NY, USA
If you ask TPIPE to split a file at N lines and the number of lines in the file is a multiple of N, you get an extra 0-byte file. Below I asked it to split the 4-line file at 2 lines.
Code:
v:\> echo My^r^ndog^r^nhas^r^nfleas. > doggy.txt
 
v:\> dir /k /m doggy*
2013-06-01  00:51              22  doggy.txt
 
v:\> tpipe /input=doggy.txt /split=2,0,0,0,0,2,doggy.txt
 
v:\> dir /k /m doggy*
2013-06-01  00:51              22  doggy.txt
2013-06-01  00:53              9  doggy.txt.000
2013-06-01  00:53              13  doggy.txt.001
2013-06-01  00:53              0  doggy.txt.002

You also get an extra 0-byte file if you ask it to split at size N and the file size is a multiple of N. Below I asked it to split the 22-byte file at 11 bytes.
Code:
v:\> del doggy.txt.0*
Deleting V:\doggy.txt.000
Deleting V:\doggy.txt.001
Deleting V:\doggy.txt.002
     3 files deleted
 
v:\> tpipe /input=doggy.txt /split=0,11,.,0,0,2,doggy.txt
 
v:\> dir /k /m doggy*
2013-06-01  00:51              22  doggy.txt
2013-06-01  01:02              11  doggy.txt.000
2013-06-01  01:02              11  doggy.txt.001
2013-06-01  01:02              0  doggy.txt.002
 
May 20, 2008
3,515
4
Elkridge, MD, USA
I also agree. Having often coded this kind of behavior, it seems easier to just blindly create the empty file instead of checking every time in the line/character processing loop whether or not it was already created. But a simple test when the loop is completed to delete it if nothing was written would eliminate the problem; also, it would allow counting files to determine the number of splits.
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
And that's OK with you? Regardless of the reason, it's crummy behavior.


I have no problem with it -- I think it's one of your theoretical problems rather than a real issue. And since I can't change it anyway, I'm not going to agonize over it. I passed it on to the developers; they said WAD and unless they change their minds we'll have to deal with it as-is.
 
May 20, 2008
11,530
102
Syracuse, NY, USA
I have no problem with it -- I think it's one of your theoretical problems rather than a real issue. And since I can't change it anyway, I'm not going to agonize over it. I passed it on to the developers; they said WAD and unless they change their minds we'll have to deal with it as-is.
You're very tolerant. And it's not theoretical. It *will* happen some (probably small) portion of the time /split is used. I don't think "crummy" was the best choice of words; it's ridiculous behavior. I doubt it would *ever* be desired behavior.
 

rconn

Administrator
Staff member
May 14, 2008
12,404
152
You're very tolerant. And it's not theoretical. It *will* happen some (probably small) portion of the time /split is used. I don't think "crummy" was the best choice of words; it's ridiculous behavior. I doubt it would *ever* be desired behavior.


You're certainly not required to use it. If an extra 0-byte file every few hundred (or few thousand) times you run TPIPE i/split s a critical problem for you, you'll undoubtedly be happier creating your own utility.

(I think this thread is following the classic pattern of "the more insignificant the problem, the more passionate the arguments.")
 
May 20, 2008
11,530
102
Syracuse, NY, USA
You're certainly not required to use it. If an extra 0-byte file every few hundred (or few thousand) times you run TPIPE i/split s a critical problem for you, you'll undoubtedly be happier creating your own utility.

(I think this thread is following the classic pattern of "the more insignificant the problem, the more passionate the arguments.")
I see it as the more ridiculous the behavior, the more passionate the argument. There's just no reason for it. It looks bad. It's a poor reflection on your product? I don't need to write my own. I have two SPLIT.EXEs (one, Gnu) that don't do it.
 
Similar threads
Thread starter Title Forum Replies Date
vefatica Fixed TPIPE doesn't /SPLIT at characters Support 0
samintz How to? TPIPE /simple=61 Support 6
R Bug TPIPE's pdf to text conversions don't work Support 2
Kachupp How to? tpipe Support 4
H TPIPE /simple=4 Support 12
D TPIPE produces unwanted logs. Support 1
Kachupp How to? tpipe Support 8
vefatica Documentation TPIPE, /perl, DotMatchesNewLines Support 1
vefatica Stop TPIPE /EOL removing bad EOLs (and TPIPE changine EOLs)? Support 2
vefatica TPIPE in an alias? Support 2
C How to? TPIPE ?'s Support 2
H History and TPipe Oddness Support 3
Jay Sage Baffling Behavior With TPIPE Support 5
vefatica TPIPE: unbalanced escaped quotes in a regex? Support 5
Joe Caverly Multiple Text Searches at once using FFIND or TPIPE Support 4
Kachupp FFIND TPIPE Support 9
vefatica TPIPE and avarice? Support 5
Peter Murschall TPIPE generate unicode on Piping or redirecting Support 3
x13 TPIPE /REPLACE - Remove line (including EOL) Support 3
Charles Dye Documentation TPIPE /REPLACELIST Support 0
Joe Caverly TPIPE and /inputstring Support 3
vefatica How to? Add real <ESC> characters with TPIPE Support 2
vefatica How to? TPIPE ... see output right away? Support 4
vefatica TPIPE.EXE crashes on Ctrl-C Support 9
O TPIPE: Error -Can´t access textpipeengine.dll Support 24
vefatica Extract fields with TPIPE? Support 10
vefatica TPIPE, crash and question Support 1
MickeyF Another TPIPE question Support 6
MickeyF Can't get my TPIPE /replace to work Support 4
Joe Caverly Printing TPIPE documentation Support 3
C WAD tpipe /simple=28 Support 8
vefatica Remove double-quotes with TPIPE Support 4
vefatica TPIPE crashes on Ctrl-C Support 1
C How to? Add date/time to custom tpipe based BTM Support 1
C tpipe /simple=28 error Support 5
C TPipe /dup Support 5
T TPipe: Replacing String with Double Quotes Support 3
C tpipe and extract email addresses Support 1
vefatica How do I do this with TPIPE? Support 1
vefatica TPIPE's /perl option? Support 1
D TPIPE help typo Support 0
vefatica TPIPE access violations are back Support 2
Joe Caverly Word Count using TPIPE Support 10
Dan Glynhampton TPIPE in Build 41 Support 4
Phileosophos TPIPE doesn't work at all with v16 Support 3
vefatica TPIPE access violation again Support 1
David McClelland TPIPE matching problem Support 3
vefatica TPIPE: Access violation Support 5
jbanaszczyk TCMD 16 - TPIPE Support 4
P TPipe relaunches TCC window and 4start, etc Support 7

Similar threads