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

    Joined:
    May 20, 2008
    Messages:
    5,675
    Likes Received:
    11
    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"?
     
    #1
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,432
    Likes Received:
    27
    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.
     
    #2
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,675
    Likes Received:
    11
    "Extract" and "remove" mean the same thing!

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

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,432
    Likes Received:
    27
    Extract means copy those lines to the output file. Remove means don't copy those lines to the output file.
     
    #4
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,675
    Likes Received:
    11
    So, do "extract matching lines" and "remove non-matching lines" mean the same thing? What about "extract non-matching lines" vs. "remove matching lines"?
     
    #5
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,432
    Likes Received:
    27
    No. When you "extract", you keep the lines (and put them in a new file). When you remove, you delete them.

    No. See above.
     
    #6
  7. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,675
    Likes Received:
    11
    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).
     
    #7
  8. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,432
    Likes Received:
    27
    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.
     
    #8
  9. vefatica

    Joined:
    May 20, 2008
    Messages:
    5,675
    Likes Received:
    11
    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.
     
    #9
  10. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,432
    Likes Received:
    27
    I would advise waiting until you actually have a need to use this syntax, by which time the documentation should be substantially complete.
     
    #10

Share This Page