[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed with Variable Substitution in the command
From: |
alex xmb sw ratchev |
Subject: |
Re: sed with Variable Substitution in the command |
Date: |
Thu, 19 Sep 2024 20:28:17 +0200 |
hmm .. weird .. dunno much too ..
greets ..
On Thursday, September 19, 2024, Greg Wooledge <greg@wooledge.org> wrote:
> On Thu, Sep 19, 2024 at 16:36:28 +0200, alex xmb sw ratchev wrote:
> > the out perl code , would it translare & s to search-in ? or is it flat
> > string ? i guess \Q is for this .. dunno ..
>
> hobbit:~$ in=foo out='bar & grill' perl -p -e
> 's/\Q$ENV{"in"}/$ENV{"out"}/g' <<< football
> bar & grilltball
>
> I don't pretend to be a perl guru, but it works in every combination I
> tested. Even without the \Q.
>
> hobbit:~$ in=foo out='bar & grill' perl -p -e 's/$ENV{"in"}/&/g' <<<
> football
> &tball
>
>