TPIPE aliases?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Many TPIPE options are long, with many parameters, and are hard to remember. I am not recommending environment variables to do the job, but some way to create and use a "library" of TPIPE aliases would keep me from having to go to the help. Here's an example.
Code:
v:\> echo 222 | tpipe /replace=4,1,0,0,0,0,0,0,0,"\x32","\x33"
333
I had to go to the help to remember the "4,1,0,0,0,0,0,0,0,". Here's an alternative (again, I'm not recommending envvars).
Code:
v:\> set rep=/replace=4,1,0,0,0,0,0,0,0,

v:\> echo 222 | tpipe %[rep]"\x32","\x33"
333
Ideal (???) might be some way to define "rep" so that I could later say
Code:
echo 222 | tpipe /rep="\x32","\x33"
 
#2
Vince, this has room for improvement, but maybe this is something to consider;
Code:
@setlocal
@echo off
tpipe /grep=^
%@iniread[.\%0,config,Type],^
%@iniread[.\%0,config,IncludeLineNumbers],^
%@iniread[.\%0,config,IncludeFileName],^
%@iniread[.\%0,config,MatchCase],^
%@iniread[.\%0,config,CountMatches],^
%@iniread[.\%0,config,PatternType],^
%@iniread[.\%0,config,UTF8],^
%@iniread[.\%0,config,IgnoreEmpty],^
%@iniread[.\%0,config,Pattern]
endlocal
quit

[config]
; Type:
;0 Restrict lines matching (for subfilters)
;1 Restrict lines NOT matching (for subfilters)
;2 Extract matches
;3 Extract matching lines (grep)
;4 Extract non-matching lines (inverse grep)
;5 Remove matching lines
;6 Remove non-matching lines
Type = 3

; IncludeLineNumbers - 1 to include the line number where the pattern was found
IncludeLineNumbers = 0

; IncludeFilename - 1 to include the filename where the pattern was found
IncludeFileName = 0

; MatchCase - 1 to do a case-sensitive comparison when matching the pattern
MatchCase = 0

; CountMatches - 1 to output a count of the number of matches
CountMatches = 0

; PatternType
; 0 Perl pattern
; 1 Egrep pattern
; 2 Brief pattern
; 3 MS Word pattern
PatternType = 0

; UTF8 - 1 to allow matching Unicode UTF8 characters
UTF8 = 0

; IgnoreEmpty - 1 to ignore empty matches
IgnoreEmpty = 0

; Pattern - the (regular expression) pattern to match
Pattern = the
Note well that the .INI file is the .BTM itself.

Example usage;
Code:
c:\users\jlc\utils>type test.txt | tgrep.btm
The
the
Example test.txt;
Code:
The
quick
brown
fox
jumped
over
the
lazy
dog
Joe