Re: steps of a path

2022-09-05 Thread Marc Chantreux
Hi Ralph, > The `.Str.say` can be just `.put`. oh! got it. thanks :) > If not, can you see why I'm surprised -- why `m:g{ "/" <-[/]>+ }` > seems simpler to me than `m:ex{^ [:r "/" <-[/]>+]+? }`? I just played again with your solution and got the beauty of it. why made me realize I should take t

Re: steps of a path

2022-09-05 Thread Fernando Santagata
Hello, you can get around the immutability problem: raku -e '"/var/log/messages".IO.map: -> $_ is copy {repeat {.put} while ! ($_ .= parent ~~ "/") }' On Mon, Sep 5, 2022 at 8:55 AM Marc Chantreux wrote: > hello William, > > On Sat, Sep 03, 2022 at 04:27:04PM -0700, William Michels wrote: > >

Re: steps of a path

2022-09-05 Thread Bruce Gray
> On Sep 5, 2022, at 1:54 AM, Marc Chantreux wrote: --snip of Bill's pointer to Mathew's email-- > I tried this line but got an immutability problem. I tried > multiple work around with no success for the moment. > <<. raku -e 'lines.IO.map: {repeat {.put} while not .=parent ~~ "/" }' > /var/log/m

Re: steps of a path

2022-09-05 Thread Marc Chantreux
I love this one. I used uniq and run so the whole script can be run from raku (except the xargs ls avoid the ARG_MAX error) <<. raku -e 'run < ls -lUd >, unique map {(.IO, *.parent …^ "/")>>.Str.Slip}, lines' /var/log/messages /var/log/auth.log regards -- Marc Chantreux Pôle de Calcul et Servi