On Tue, May 20, 2025 at 12:51 PM William Michels via perl6-users <
perl6-us...@perl.org> wrote:

> If you haven't visited U&L StackExchange, you should! It's much less
> 'siloed' than StackOverflow in that an OP might post a question requesting
> a bash/sed/awk answer, but other answers are readily accepted (and
> upvoted!) as well. Some good answers written in:  bash, zsh, sed, awk, jq,
> mlr, Ruby, Perl, and Raku. Check it out!
>

Cool!  I'll have to drop by sometime.  I've been moving to use Raku in
place of shell scripts or commands more often.  A short time ago I wanted
to get a list of directories along with the total page count of all PDF
files within them, sorted by the page counts, and I was able to do it with
a short-ish Raku one-liner (broken into multiple lines here for clarity):

.say for sort dir.map: {
  run('exiftool', .dir.grep(/'.pdf'$/), :out)
    .out.slurp.match(:g, /^^ 'Page Count' \N+? <( \d+ $$/).sum => ~$_ if .d
}

The one thing that's hardest for me to keep in mind is to use "\N" instead
of ".", which here silently produces dramatically wrong results.

Reply via email to