TPipe /dup=...format spec

Jan 18, 2011
12
0
TPIPE - Text filtering, search, and substitution
format - %[index ":"][-][width][.precision]type

I haven't had any luck with specifying the format.
What are the choices for the [index":"] part? Are the quotes required? Is the 'index' required? What does it do?
I'm thinking the rest is standard printf stuff, eg ...-19.19s, 6.2f, ...
 
May 20, 2008
11,046
90
Syracuse, NY, USA
I'm just playing around here. Here's one that works.

Code:
v:\> echo foo bar^r^nfoo bar^r^nbar foo^r^nfoo bar^r^nbar foo | tpipe /dup=1,1,1,100,0,"%%d times for the line "%%s""
2 times for the line "bar foo"
3 times for the line "foo bar"

I can't get the example in the help,

Code:
"string %%1:s count %%0:d"

or anything like it, to do anything but give an error. If I'm interpreting things correctly, it's asking for string 1 together with the count for string 0 (which seems odd).[/code]
 
Jan 18, 2011
12
0
Thanks, just what I needed to see!
BTW with your input put in testtpipe I get,
Code:
cat testtpipe |tpipe /inpput=testpipe2 /dup=1,1,1,100,0,"string %%1:s count %%0:d"
string This is a duplicate line count 3
string This is a duplicate line 5 count 2
I couldn't figure out what to do with that example and until I got you example.
 
May 20, 2008
11,046
90
Syracuse, NY, USA
Code:
cat testtpipe |tpipe /inpput=testpipe2 /dup=1,1,1,100,0,"string %%1:s count %%0:d"
string This is a duplicate line count 3
string This is a duplicate line 5 count 2

You're CATing a file and piping the output to TPIPE and at the same time specifying an input file for TPIPE. All you're going to get is the output of

Code:
tpipe /inpput=testpipe2 /dup=1,1,1,100,0,"string %%1:s count %%0:d"

You can do it one way or the other. I don't think you should mix them

Code:
v:\> tpipe /input=testpipe /dup=1,1,1,100,0,"string %%1:s count %%0:d"
string one count 3
string two count 2

v:\> type testpipe | tpipe /dup=1,1,1,100,0,"string %%1:s count %%0:d"
string one count 3
string two count 2
 
Jan 18, 2011
12
0
Right. I was careless in not deleting the input flag, when I catted it. Near as I can tell though it just discards stdin when /input is given. Of course only the careless would care about that.