TPIPE /grep?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
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
10,163
86
#2
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.
 
#3
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
 
#7
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).
 
#9
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.