Documentation TPIPE /string type code confusion

Aug 28, 2008
124
4
The documentation for the TPIPE /string filter shows the following type codes:
6 Remove lines matching the Perl pattern
7 Retain lines matching the Perl pattern
I'm finding the results I'm seeing a bit confusing, insofar as they seem the opposite of what this describes. Consider the following sample text:
This is George's first line
This is Jimmy's first line
This is George's second line
This is Jimmy's second line
When I type this text through "tpipe /string=6,0,m/George/", I get:
This is George's first line
This is George's second line
But when I type this text through "tpipe /string=7,0,m/George/" I get:
This is Jimmy's first line
This is Jimmy's second line
From the docs, I expected type code 6 to remove the lines with 'George' and code 7 to retain them, but the output suggests the opposite. Is this because TPIPE "filters" things, so from the perspective of retaining in the filter they go away while I guess 'remove' ends up meaning they pass through the filter and are seen? Whatever the case, it seems to me like the documentation might be a little confusing. Thanks in advance!
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I don't know how or why, but the m// is confusing TPIPE.
Code:
v:\> type george.txt
This is George's first line
This is Jimmy's first line
This is George's second line
This is Jimmy's second line

v:\> type george.txt | tpipe /string=6,0,m/foo/
This is George's first line
This is George's second line

I don't think m/pattern/ is, strictly-speaking, a Perl "pattern" (rather a search instruction). All seems OK if I simply specify a pattern.
Code:
v:\> type george.txt | tpipe /string=6,0,"George"
This is Jimmy's first line
This is Jimmy's second line

v:\> type george.txt | tpipe /string=7,0,"George"
This is George's first line
This is George's second line

v:\> type george.txt | tpipe /string=6,0,George
This is Jimmy's first line
This is Jimmy's second line

v:\> type george.txt | tpipe /string=6,0,Ge..ge
This is Jimmy's first line
This is Jimmy's second line
 
May 20, 2008
11,400
99
Syracuse, NY, USA
I'm still not quite sure what TPIPE is doing on my last example. Below, in the first one, apparently TPIPE finds m in "Jimmy" and removes the lines; in the second, it finds g in "George" and removes those. It's just ignoring the "/foo/" in both cases.
Code:
v:\> type george.txt | tpipe /string=6,0,m/foo/
This is George's first line
This is George's second line

v:\> type george.txt | tpipe /string=6,0,g/foo/
This is Jimmy's first line
This is Jimmy's second line
 

rconn

Administrator
Staff member
May 14, 2008
12,344
149
I'm still not quite sure what TPIPE is doing on my last example. Below, in the first one, apparently TPIPE finds m in "Jimmy" and removes the lines; in the second, it finds g in "George" and removes those. It's just ignoring the "/foo/" in both cases.
Code:
v:\> type george.txt | tpipe /string=6,0,m/foo/
This is George's first line
This is George's second line

v:\> type george.txt | tpipe /string=6,0,g/foo/
This is Jimmy's first line
This is Jimmy's second line

TPIPE thinks your /foo/ argument is a new switch for TPIPE. Enclose it in double quotes if you don't want it to be parsed as a switch; i.e.:

Code:
type george.txt | tpipe /string=6,0,"m/foo/"

TPIPE will strip the quotes before parsing the file.
 
Similar threads
Thread starter Title Forum Replies Date
T TPipe: Replacing String with Double Quotes Support 3
vefatica Back-refs in TPIPE's /replace's replacement string? Support 2
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
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