TPIPE /grep?

May 20, 2008
9,861
69
Syracuse, NY, USA
How is it supposed to work? It has 8 parameters, right? None of these work.
Code:
g:\tc14> type fleas.txt
My
dog
has
fleas.
 
g:\tc14> do i=0 to 6 (tpipe /input=fleas.txt /grep=%i,0,0,0,0,0,0,M)
TPIPE: The parameter is incorrect.
"/grep=0,0,0,0,0,0,0,M"
TPIPE: The parameter is incorrect.
"/grep=1,0,0,0,0,0,0,M"
TPIPE: The parameter is incorrect.
"/grep=2,0,0,0,0,0,0,M"
TPIPE: The parameter is incorrect.
"/grep=3,0,0,0,0,0,0,M"
TPIPE: The parameter is incorrect.
"/grep=4,0,0,0,0,0,0,M"
TPIPE: The parameter is incorrect.
"/grep=5,0,0,0,0,0,0,M"
TPIPE: The parameter is incorrect.
"/grep=6,0,0,0,0,0,0,M"
And what are the differences among "restrict", "extract", and "remove"?
 

rconn

Administrator
Staff member
May 14, 2008
11,425
108
How is it supposed to work? It has 8 parameters, right?
No, it has 9 parameters:

Type​
IncludeLineNumbers​
IncludeFilename​
MatchCase​
CountMatches​
PatternType​
UTF8​
IgnoreEmpty​
Pattern​

(But I didn't think anybody would be crazy brave enough to try it while it was still flagged as untested!)

Tested and fixed some minor bugs for build 15.

And what are the differences among "restrict", "extract", and "remove"?
Extract and remove seem pretty self-explanatory. Restrict is only relevant for subfilters, which I haven't documented yet.
 
May 20, 2008
9,861
69
Syracuse, NY, USA
No, it has 9 parameters:

Type​
IncludeLineNumbers​
IncludeFilename​
MatchCase​
CountMatches​
PatternType​
UTF8​
IgnoreEmpty​
Pattern​

(But I didn't think anybody would be crazy brave enough to try it while it was still flagged as untested!)

Tested and fixed some minor bugs for build 15.



Extract and remove seem pretty self-explanatory. Restrict is only relevant for subfilters, which I haven't documented yet.
"Extract" and "remove" mean the same thing!

PatternType" missing here (from the help).
Code:
 /grep=Type,IncludeLineNumbers,IncludeFilename,IgnoreCase,CountMatches,UTF8,IgnoreEmpty,Pattern
 
May 20, 2008
9,861
69
Syracuse, NY, USA
Extract means copy those lines to the output file. Remove means don't copy those lines to the output file.
So, do "extract matching lines" and "remove non-matching lines" mean the same thing? What about "extract non-matching lines" vs. "remove matching lines"?
 
May 20, 2008
9,861
69
Syracuse, NY, USA
No. When you "extract", you keep the lines (and put them in a new file). When you remove, you delete them.
I still don't get it. When you "remove non-matching lines", what happens to the matching ones? In a very simple test, /grep with types 3 (extract matching lines) and 6 (remove non-matching lines) produce the same output (or an identical file).
 
May 20, 2008
9,861
69
Syracuse, NY, USA
Try it in a not-very-simple test, when you're sending output to multiple files, or overwriting the original file, or passing the results to subfilters.
Grep types 3 and 6 seem to work the same when overwriting the input file. I don't know how to specify multiple output files and I know even less about subfilters. This reminds me a little of trying to figure out how Oniguruma works from the header file.