Re: run on regex line?
[email protected] (Richard Hainsworth)
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <[email protected]> |
Todd, You could use Elizabeth Mattijsen's App-rak. It's a Raku utility that does grep, sed, awk. Richard On 20/01/2024 10:53, ToddAndMargo via perl6-users wrote: > On 1/20/24 01:42, William Michels via perl6-users wrote: >> >>> On Jan 19, 2024, at 23:49, ToddAndMargo via perl6-users >>> <[email protected]> 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 >> > > I like this one! It is easy to figure out at a glance. > > >> #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: >> >> https://stackoverflow.com/questions/65066358/concatenating-s-in-raku >> <https://stackoverflow.com/questions/65066358/concatenating-s-in-raku> >> >> HTH, Bill > > It does. Thank you! > > Raku's regex's spoil me. sed has to be > the editor from ... > > Then again, I still use vi at times.