Closed Zer0-Tolerance closed 1 year ago
Would --patterns-from
be a good (long) name for it? And I guess that --patterns-from=-
would then read the patterns from STDIN.
I'm a bit puzzled about:
Read one or more newline separated patterns from file. Empty pattern lines match every input line. Newlines are not considered part of a pattern. If file is empty, nothing is matched.
particularly the "Empty pattern lines match every input line". So any empty line in such a file, would mean that all lines would be automatically selected? What would the use of the other patterns be then? I could see a use for just one empty line, though. Puzzled.
the main use case from my perspective is to check for a list of regex or specific strings so I wouldn't mind to much about the "empty line" in this feature.
thanks for adding --patterns-from
it's great ! but I'm getting an error when I try to specify a regex in the file:
cat /tmp/pattern
111
abc
/^ab/
rak --patterns-from=/tmp/pattern /tmp/
A worker in a parallel iteration (hyper or race) initiated here:
in sub show-results at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 830
in sub rak-results at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 701
in sub action-per-line at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 2915
in sub main at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 423
in block <unit> at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/resources/5A8CE6ED95A092BFB0EF7BA388399642ED16103A line 3
in sub MAIN at /Users/.rakubrew/shims/rak line 3
in block <unit> at /Users/.rakubrew/shims/rak line 1
Died at:
No such method '!cursor_start' for invocant of type 'Str'
in sub show-results at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 830
in sub rak-results at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 701
in sub action-per-line at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 2915
in sub main at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/sources/06D54E7B08D71050D35620285F06BBF9BAC471C3 (App::Rak) line 423
in block <unit> at /Users/.rakubrew/versions/moar-2022.07/share/perl6/site/resources/5A8CE6ED95A092BFB0EF7BA388399642ED16103A line 3
in sub MAIN at /Users/.rakubrew/shims/rak line 3
in block <unit> at /Users/.rakubrew/shims/rak line 1
with this file:
cat /tmp/pattern
^a.c
^1
you'll get the same error as above but if you got only a single regex in the file then it's working fine.
Thanks for the report. I'll look at this tomorrow
Can you plan to add a feature to read pattern from file as in -f in grep ?