1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

TPIPE /grep?

Discussion in 'Support' started by vefatica, May 16, 2012.

  1. vefatica

    vefatica

    Messages:
    5,058
    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"?
  2. rconn

    rconn Administrator Staff Member

    Messages:
    6,707
    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.
  3. vefatica

    vefatica

    Messages:
    5,058
    "Extract" and "remove" mean the same thing!

    PatternType" missing here (from the help).
    Code:
     /grep=Type,IncludeLineNumbers,IncludeFilename,IgnoreCase,CountMatches,UTF8,IgnoreEmpty,Pattern
     
    
  4. rconn

    rconn Administrator Staff Member

    Messages:
    6,707
    Extract means copy those lines to the output file. Remove means don't copy those lines to the output file.
  5. vefatica

    vefatica

    Messages:
    5,058
    So, do "extract matching lines" and "remove non-matching lines" mean the same thing? What about "extract non-matching lines" vs. "remove matching lines"?
  6. rconn

    rconn Administrator Staff Member

    Messages:
    6,707
    No. When you "extract", you keep the lines (and put them in a new file). When you remove, you delete them.

    No. See above.
  7. vefatica

    vefatica

    Messages:
    5,058
    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).
  8. rconn

    rconn Administrator Staff Member

    Messages:
    6,707
    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.
  9. vefatica

    vefatica

    Messages:
    5,058
    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.
  10. rconn

    rconn Administrator Staff Member

    Messages:
    6,707
    I would advise waiting until you actually have a need to use this syntax, by which time the documentation should be substantially complete.

Share This Page