> On Jan 19, 2024, at 23:49, ToddAndMargo via perl6-users 
> <perl6-us...@perl.org> wrote:
> Hi All,
> Can I do a run on line with a regex like I
> just did with sed?
> $ zbarimg Screenshot.png | sed -e 's/.*?secret=//' -e 's/&.*//'
> Usually I just do two lines in Raku.
> Many thanks,
> -T

Hi Todd, 

Not that I am aware. The naive way is just to pipe them:

~$ echo 'roses are red' | raku -pe 's/roses/lilacs/' | raku -pe 's/red/blue/'
lilacs are blue 

The Raku way would be combining those two statements into one Raku call:

~$ echo 'roses are red' | raku -pe 's/roses/lilacs/; s/red/blue/'
lilacs are blue

#OR ("big-S" notation below)

~$ echo 'roses are red' | raku -ne 'S/roses/lilacs/ andthen S/red/blue/.put'
lilacs are blue

The `andthen` call reloads the `$_` topic variable. For more examples, see:


HTH, Bill

Reply via email to