On Fri, Apr 13, 2018 at 12:31 PM, Shlomi Fish <shlo...@shlomifish.org <mailto:shlo...@shlomifish.org>> wrote:

    Hi Todd,

    On Fri, 13 Apr 2018 03:00:22 -0700
    ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>>
    wrote:

    > echo "total kB          180448    2980     112" | awk '{print $4}')

shlomif[Perl6]:$trunk$ echo "total kB 180448 2980 112" | perl6
    -n -e 'say .split(/\s+/)[3]'

    2980

shlomif[Perl6]:$trunk$ echo "total kB 180448 2980 112" | awk
    '{print $4}'

    2980

    See https://docs.perl6.org/language/5to6-nutshell#-a
    <https://docs.perl6.org/language/5to6-nutshell#-a> and
    http://perldoc.perl.org/perlrun.html
    <http://perldoc.perl.org/perlrun.html> .



On 04/13/2018 04:13 AM, Fernando Santagata wrote:
Hi,

Since "There's More Than One Way To Do It", one can look for the value, instead of the separator:

$ echo "total kB          180448    2980     112" |perl6 -n -e 'say .comb(/\d+/)[1]'
2980


So the second d+ is [1].  Fascinating.  Thank you!

Reply via email to