Re: another one liner

2017-08-07 Thread Bruce Gray
> 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

Re: another one liner

2017-08-05 Thread ToddAndMargo
On 08/05/2017 12:34 AM, Elizabeth Mattijsen wrote: On 5 Aug 2017, at 09:21, 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]' Would some kind person please tell

Re: another one liner

2017-08-05 Thread Elizabeth Mattijsen
> On 5 Aug 2017, at 09:21, 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]' > > Would some kind person please tell me what is going on here? say the result

Re: another one liner

2017-08-05 Thread Elizabeth Mattijsen
> On 5 Aug 2017, at 08:50, 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]' > > >

Re: another one liner

2017-08-05 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="/ >>>

Re: another one liner

2017-08-05 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? >

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—

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