Re: another one liner

2017-08-04 Thread Brandon Allbery
On Sat, Aug 5, 2017 at 2:50 AM, Sean McAfee wrote: > On Fri, Aug 4, 2017 at 10:18 PM, ToddAndMargo > wrote: > >> On 08/04/2017 08:43 PM, Bruce Gray wrote: >> >>> >>> P6-ish version: >>> ifconfig | perl6 -e 'say lines.map({ ~$0 if /^(\S+) ": flags="/ >>> }).sort[1]' >>> >> >> > Wait a second. Ho

Re: Thank you guys!

2017-08-04 Thread İsmail Arılık
Waaoowww, this list is very active. Maybe we need a forum app like Discourse... (I am not related with Discourse, just love it.) Especially, when we think about Google Groups got ban in some countries like mine(Turkey), it will be very good. Thanks and regards. 5 Ağu 2017 Cmt 04:02 tarihinde Todd

Re: another one liner

2017-08-04 Thread Sean McAfee
On Fri, Aug 4, 2017 at 10:18 PM, ToddAndMargo wrote: > On 08/04/2017 08:43 PM, Bruce Gray wrote: > >> >> P6-ish version: >> ifconfig | perl6 -e 'say lines.map({ ~$0 if /^(\S+) ": flags="/ >> }).sort[1]' >> > > Wait a second. How does map skip input elements like that? > map { $_ if $_ %% 2 }, 1

Re: another one liner

2017-08-04 Thread ToddAndMargo
On 08/04/2017 08:43 PM, Bruce Gray wrote: On Aug 4, 2017, at 9:12 PM, ToddAndMargo wrote: Hi All, How would you convert this one liner over to a Perl 6 one liner with a pipe? ifconfig | grep flags | awk '{print $1}' | sort | sed -n 2,2p | sed -e 's/://‘ —snip— First attempt; straight tran

Re: another one liner

2017-08-04 Thread Timo Paulssen
Sorry, i typo'd ifconfig | perl6 -e 'lines.grep(/flags/).map(*.words[0]).sort[1].chop' On 08/05/2017 05:41 AM, ToddAndMargo wrote: > On 08/04/2017 08:14 PM, Timo Paulssen wrote: >> ifconfig | perl6 -e 'lines.grep("flags").map(*.words[0]).sort[1].chop' >> >> this should do the trick. i'm not sure

Re: another one liner

2017-08-04 Thread ToddAndMargo
On 08/04/2017 08:14 PM, Timo Paulssen wrote: ifconfig | perl6 -e 'lines.grep("flags").map(*.words[0]).sort[1].chop' this should do the trick. i'm not sure if 2,2p is meant to "output just the second result" and if it's okay to just unconditionally remove the last character. hth - Timo 2,

Re: Got me one too many p6's

2017-08-04 Thread ToddAndMargo
On 08/04/2017 08:14 PM, Brandon Allbery wrote: On Fri, Aug 4, 2017 at 10:50 PM, ToddAndMargo > wrote: I renamed the one in /opt and reran "updatedb" and now "which" find perl6 in /usr/bin instead of /opt/rakudo/bin. Do I need to do anything else? Argu

Re: another one liner

2017-08-04 Thread Timo Paulssen
ifconfig | perl6 -e 'lines.grep("flags").map(*.words[0]).sort[1].chop' this should do the trick. i'm not sure if 2,2p is meant to "output just the second result" and if it's okay to just unconditionally remove the last character. hth - Timo

Re: Got me one too many p6's

2017-08-04 Thread Brandon Allbery
On Fri, Aug 4, 2017 at 10:50 PM, ToddAndMargo wrote: > > I renamed the one in /opt and reran "updatedb" and now > "which" find perl6 in /usr/bin instead of /opt/rakudo/bin. > > Do I need to do anything else? Arguably all you needed to do was remove /opt/rakudo/bin from $PATH, both in open shells

Re: Got me one too many p6's

2017-08-04 Thread ToddAndMargo
On 08/04/2017 07:40 PM, ToddAndMargo wrote: Hi All, Believe it or not EPEL beat Fedora to Rakudo 2017.07. Now I got me two perl 6's $ /opt/rakudo/bin/perl6 -v This is Rakudo version 2017.03 built on MoarVM version 2017.03 implementing Perl 6.c. $ /usr/bin/perl6 -v This is Rakudo version 2017.

ignore my previous mail [was: Re: how do you pipe to perl6?]

2017-08-04 Thread Timo Paulssen
Should have read the other threads first where this was answered by others

Re: how do you pipe to perl6?

2017-08-04 Thread Timo Paulssen
This is not what you meant to do: $ echo -e "abc\ndef\nghi" | perl6 -e 'my @y = split "\n", lines; say @y.perl ["abc def ghi"] the lines sub already gives you a list of lines that perl6 gets fed, you're calling split on that array that then gets coerced to a string (which joins the lines with spa

Got me one too many p6's

2017-08-04 Thread ToddAndMargo
Hi All, Believe it or not EPEL beat Fedora to Rakudo 2017.07. Now I got me two perl 6's $ /opt/rakudo/bin/perl6 -v This is Rakudo version 2017.03 built on MoarVM version 2017.03 implementing Perl 6.c. $ /usr/bin/perl6 -v This is Rakudo version 2017.07 built on MoarVM version 2017.07 implementi

another one liner

2017-08-04 Thread ToddAndMargo
Hi All, How would you convert this one liner over to a Perl 6 one liner with a pipe? ifconfig | grep flags | awk '{print $1}' | sort | sed -n 2,2p | sed -e 's/://' enp6s0 Many thanks, -T # ifconfig br0: flags=4099 mtu 1500 inet 192.168.255.10 netmask 255.255.255.0 broadcast 1

Re: Thank you guys!

2017-08-04 Thread ToddAndMargo
On 08/04/2017 05:54 PM, ToddAndMargo wrote: Today you guys taught me how to 1) pipe to a one liner 2) use split in P6 (a little different than p5) 3) lines 4) words Thank you! Words is sweet! Much easier than awk

Thank you guys!

2017-08-04 Thread ToddAndMargo
Today you guys taught me how to 1) pipe to a one liner 2) use split in P6 (a little different than p5) 3) lines 4) words Thank you!

Re: Help me be greedy!

2017-08-04 Thread ToddAndMargo
On 08/04/2017 03:24 PM, Brent Laabs wrote: PCRE has the /U flag that reverses the behavior of .* and .*? (/PCRE_UNGREEDY)/ Greed ultimately wasn't the issue. I screwed up a bunch of other things.

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
On 08/04/2017 03:42 PM, Brandon Allbery wrote: On Fri, Aug 4, 2017 at 6:28 PM, ToddAndMargo > wrote: Here is my last attempt: ip -o -f inet addr show | perl6 -e 'for ( lines ) -> $I { if ( $I ~~ /enp/ ) { say "Interface <" ~ .words[1] ~ ">\nIP<" ~ .word

Re: Need awk print sub

2017-08-04 Thread Brandon Allbery
On Fri, Aug 4, 2017 at 6:28 PM, ToddAndMargo wrote: > Here is my last attempt: > > ip -o -f inet addr show | perl6 -e 'for ( lines ) -> $I { if ( $I ~~ /enp/ > ) { say "Interface <" ~ .words[1] ~ ">\nIP<" ~ .words[3] ~ ">"; } }' > No such method 'words' for invocant of type 'Any' > in block at

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
On 08/04/2017 02:13 PM, Brandon Allbery wrote: (back on the desktop for the moment...) On Fri, Aug 4, 2017 at 5:04 PM, ToddAndMargo > wrote: On 08/04/2017 01:00 PM, ToddAndMargo wrote: How do I do this with a perl one liner? $ echo "a b c d"

Re: Help me be greedy!

2017-08-04 Thread Brent Laabs
PCRE has the /U flag that reverses the behavior of .* and .*? ( *PCRE_UNGREEDY)* This was always a terrible idea, and is probably the source of your confusion. On Fri, Aug 4, 2017 at 12:38 PM, Brandon Allbery wrote: > Like I said, greedy is the default, *.? says *don't* be greedy. You wanted >

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
On 08/04/2017 02:31 PM, Elizabeth Mattijsen wrote: On 4 Aug 2017, at 22:53, ToddAndMargo wrote: On 08/04/2017 01:26 PM, Elizabeth Mattijsen wrote: echo "a b c d" | perl6 -e 'say words[1]’ Tears. :'( $ echo "a b c d" | perl6 -e 'say words[1]' ===SORRY!=== Error while compiling -e Callin

Re: Need awk print sub

2017-08-04 Thread Elizabeth Mattijsen
> On 4 Aug 2017, at 22:53, ToddAndMargo wrote: > > On 08/04/2017 01:26 PM, Elizabeth Mattijsen wrote: >> echo "a b c d" | perl6 -e 'say words[1]’ > > > Tears. :'( > > $ echo "a b c d" | perl6 -e 'say words[1]' > > ===SORRY!=== Error while compiling -e > Calling words() will never work with

Re: Need awk print sub

2017-08-04 Thread Brandon Allbery
(back on the desktop for the moment...) On Fri, Aug 4, 2017 at 5:04 PM, ToddAndMargo wrote: > On 08/04/2017 01:00 PM, ToddAndMargo wrote: > >> How do I do this with a perl one liner? >> >> $ echo "a b c d" | awk '{print $2}' >> b >> > > $ echo "a b c d" | perl6 -n -e 'say lines ~ "\n" ~ .words[

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
On 08/04/2017 01:00 PM, ToddAndMargo wrote: Hi All, How do I do this with a perl one liner? $ echo "a b c d" | awk '{print $2}' b Many thanks, -T And it is getting weirder: $ echo "a b c d" | perl6 -n -e 'say lines ~ "\n" ~ .words[2];' ( c) without "-n" ".words" doesn't work. With "-n" "

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
On 08/04/2017 01:53 PM, ToddAndMargo wrote: $ echo "a b c d" | perl6 -e 'say words[1]' And with the . before words $ echo "a b c d" | perl6 -e 'say .words[1]' No such method 'words' for invocant of type 'Any' in block at -e line 1

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
>> Hi All, >> >> How do I do this with a perl one liner? >> >> $ echo "a b c d" | awk '{print $2}' >> b >> >> Many thanks, >> -T On 08/04/2017 01:31 PM, Patrick R. Michaud wrote: How about... $ echo "a b c d" | ./perl6 -n -e '.words[1].say' b Pm On Fri, Aug 04, 2017 at 01:00:52PM -0700, ToddA

Re: Need awk print sub

2017-08-04 Thread ToddAndMargo
On 08/04/2017 01:26 PM, Elizabeth Mattijsen wrote: echo "a b c d" | perl6 -e 'say words[1]’ Tears. :'( $ echo "a b c d" | perl6 -e 'say words[1]' ===SORRY!=== Error while compiling -e Calling words() will never work with any of these multi signatures: ($what, $limit = Inf, *%named) at -

Re: Need awk print sub

2017-08-04 Thread Patrick R. Michaud
How about... $ echo "a b c d" | ./perl6 -n -e '.words[1].say' b Pm On Fri, Aug 04, 2017 at 01:00:52PM -0700, ToddAndMargo wrote: > Hi All, > > How do I do this with a perl one liner? > > $ echo "a b c d" | awk '{print $2}' > b > > Many thanks, > -T

Re: Need awk print sub

2017-08-04 Thread Elizabeth Mattijsen
> On 4 Aug 2017, at 22:00, ToddAndMargo wrote: > > Hi All, > > How do I do this with a perl one liner? > > $ echo "a b c d" | awk '{print $2}' > b echo "a b c d" | perl6 -e 'say words[1]’ Note array indices in Perl 6 are 0 based.

Need awk print sub

2017-08-04 Thread ToddAndMargo
Hi All, How do I do this with a perl one liner? $ echo "a b c d" | awk '{print $2}' b Many thanks, -T

Re: Help me be greedy!

2017-08-04 Thread Brandon Allbery
Like I said, greedy is the default, *.? says *don't* be greedy. You wanted .* for greedy match. But even with that, the extra .* before the f was telling it to eat stuff (greedily, since no ?, so it out-greed-ed the captured non-greedy .*?). On Friday, August 4, 2017, ToddAndMargo wrote: > On Fr

Re: Help me be greedy!

2017-08-04 Thread ToddAndMargo
On Friday, August 4, 2017, ToddAndMargo > wrote: Hi All, I NEED TO BE GREEDY! HAHA HAHA . Okay, I am back in control of myself (for the moment). What am I doing wrong here? perl6 -e 'my $x="a b c d e f"; $x ~~ m/.*?(c.*?).*f/; say "<$0>";'

Re: Help me be greedy!

2017-08-04 Thread Brandon Allbery
The ? is the opposite of greedy, just as in pcre/perl 5. Greedy is the default. I also don't see why you have a .* before f if you want to capture everything before the f. On Friday, August 4, 2017, ToddAndMargo wrote: > Hi All, > > I NEED TO BE GREEDY! HAHA HAHA . > > Okay, I am back in contro

Help me be greedy!

2017-08-04 Thread ToddAndMargo
Hi All, I NEED TO BE GREEDY! HAHA HAHA . Okay, I am back in control of myself (for the moment). What am I doing wrong here? perl6 -e 'my $x="a b c d e f"; $x ~~ m/.*?(c.*?).*f/; say "<$0>";' I am after I want the space at the end too

Re: split and one liner problem

2017-08-04 Thread ToddAndMargo
On 08/04/2017 12:07 PM, Brandon Allbery wrote: Sorry, I forgot the block thing (it reads the following block as a parameter). ``` lines() ``` would also have worked. I really appreciate the help. And it was a good exercise in troubleshooting!

Re: split and one liner problem

2017-08-04 Thread Brandon Allbery
Sorry, I forgot the block thing (it reads the following block as a parameter). ``` lines() ``` would also have worked. On Friday, August 4, 2017, ToddAndMargo wrote: > > > On Friday, August 4, 2017, ToddAndMargo > > wrote: > > > > Hi All, > > > > > > What a

Re: split and one liner problem

2017-08-04 Thread ToddAndMargo
> On Friday, August 4, 2017, ToddAndMargo > wrote: > > Hi All, > > > What am I doing wrong here? > > $ echo -e "abc\ndef\nghi" | perl6 -e 'for ( split "\n", lines ) { > say "<$_>"; }' > > > > > I am trying to get > > > > On

Re: split and one liner problem

2017-08-04 Thread Brandon Allbery
That's a weird thing to do. You call a function that returns the lines of input as a list, in a context that joins them back together as words, and then try to split the result on lines again. lines already gives you what you want. Don't split. perl6 -e 'for lines { say "<$_>"; }' On Friday, Aug

split and one liner problem

2017-08-04 Thread ToddAndMargo
Hi All, What am I doing wrong here? $ echo -e "abc\ndef\nghi" | perl6 -e 'for ( split "\n", lines ) { say "<$_>"; }' I am trying to get

Re: how do you pipe to perl6?

2017-08-04 Thread ToddAndMargo
On 08/04/2017 01:07 AM, Elizabeth Mattijsen wrote: On 4 Aug 2017, at 09:47, Todd Chester wrote: In Linux, how do I things to a perl6 one liner? I want to send ip -o -f inet addr show | perl6 ***dig out the netmask on eno1*** I know how to dig out the net mask, I just don't how to pipe to th

Re: how do you pipe to perl6?

2017-08-04 Thread ToddAndMargo
On Fri, 4 Aug 2017 at 08:47 Todd Chester > wrote: Hi All, In Linux, how do I things to a perl6 one liner? I want to send ip -o -f inet addr show | perl6 ***dig out the netmask on eno1*** I know how to dig out the net mask, I just don't how

Re: how do you pipe to perl6?

2017-08-04 Thread Simon Proctor
>From the perl6 -h response you have the standard Perl command line switches -e program one line of program, strict is enabled by default With this case $*IN has the content from the pipe going into it. Personally I combine -e with one of the next two -n run program

how do you pipe to perl6?

2017-08-04 Thread Todd Chester
Hi All, In Linux, how do I things to a perl6 one liner? I want to send ip -o -f inet addr show | perl6 ***dig out the netmask on eno1*** I know how to dig out the net mask, I just don't how to pipe to the command. Many thanks, -T