> On Aug 4, 2017, at 9:12 PM, ToddAndMargo <toddandma...@zoho.com> 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 translation:
ifconfig | perl6 -e 'say lines().grep({/flags/}).map({.words.[0].subst(/":"$/, 
"")}).sort.[1]'

P6-ish version:
ifconfig | perl6 -e 'say lines.map({ ~$0 if /^(\S+) ": flags="/ }).sort[1]'

— 
Hope this helps,
Bruce Gray (Util of PerlMonks)

Reply via email to