Just want to elaborate on the two different ways of combining statements 
mentioned earlier.


1A.  If you're using `-pe` command line flags, you use `s///` and combine 
statements with `;` semicolon:

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

1B.  Using `-pe` with `s///` but `andthen` instead of `;` is apparently a 
mistake--you don't get what you expect:

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


2A.  Conversely, if you're using `-ne` command line flags, you use `S///` and 
combine statements with `andthen`:

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

2B.  Again, using `-ne` with `S///` but `;` instead of `andthen` is apparently 
a mistake--you don't get what you expect:

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


HTH, Bill.


> On Jan 20, 2024, at 04:20, Richard Hainsworth <rnhainswo...@gmail.com> wrote:
> Todd,
> You could use Elizabeth Mattijsen's App-rak. It's a Raku utility that does 
> grep, sed, awk.
> Richard

Reply via email to