[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed with Variable Substitution in the command
From: |
Greg Wooledge |
Subject: |
Re: sed with Variable Substitution in the command |
Date: |
Thu, 19 Sep 2024 10:53:43 -0400 |
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