On 06/03/2018 05:41 PM, Xin Cheng wrote:
Hi,
I am trying to make a program to do grep with perl6 regular expression,
and I would like to colorize the matched part to the terminal. So the
following is what I wrote
sub MAIN(Str $pattern,Str $filename){
for $filename.IO.lines -> $line {
Thanks Bruce,
This is great, and It works as I expected.
I appreciate all the helps.
Regards
Xin
> On Jun 4, 2018, at 9:04 AM, Bruce Gray wrote:
>
>
>> On Jun 3, 2018, at 7:41 PM, Xin Cheng wrote:
>>
>> I am trying to make a program to do grep with perl6 regular expression, and
>> I woul
> On Jun 3, 2018, at 7:41 PM, Xin Cheng wrote:
>
> I am trying to make a program to do grep with perl6 regular expression, and I
> would like to colorize the matched part to the terminal.
—snip--
> if $temp ~~ s/ (<$pattern>) /\\x1b\[31m$0\\x1b\[0m/ {say $temp}
—snip—
Change this:
You might want to consider using Terminal::ANSIColor.
On Sun, Jun 3, 2018 at 5:53 PM, Xin Cheng wrote:
> I just tried to use "put" in place of "say", and got the same result.
>
> Thanks.
>
> Ziping
>
>
> On Jun 3, 2018, at 8:44 PM, Brandon Allbery wrote:
>
> "say" uses the .gist method, which q
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256
In proper Perl fashion, there's a module for this:
https://github.com/tadzik/Terminal-ANSIColor
I haven't used it myself, so I'm not sure how well it works, but it's
worth a shot at least.
On Sun, 3 Jun 2018 20:41:32 -0400
Xin Cheng wrote:
> Hi,
I just tried to use "put" in place of "say", and got the same result.
Thanks.
Ziping
> On Jun 3, 2018, at 8:44 PM, Brandon Allbery wrote:
>
> "say" uses the .gist method, which quotes the output for readability. You
> probably want "put" instead.
>
> On Sun, Jun 3, 2018 at 8:42 PM Xin Cheng
"say" uses the .gist method, which quotes the output for readability. You
probably want "put" instead.
On Sun, Jun 3, 2018 at 8:42 PM Xin Cheng wrote:
> Hi,
>
> I am trying to make a program to do grep with perl6 regular expression,
> and I would like to colorize the matched part to the terminal