[CentOS] sed question

John R Pierce pierce at hogranch.com
Tue Aug 25 17:56:16 UTC 2015


On 8/25/2015 10:50 AM, Jerry Geis wrote:
> ------------------- This is the two line script
> CHANGE="1234"
>
> cat my_file.txt | sed 's/CANCELID/$CHANGE/' > cancel.txt
> -------------------
>
> and the my_file.txt has:
>           <v1:notificationId>CANCELID</v1:notificationId>
>
> it gets changed to $CHANGE instead of the actual value 1234 .
> I tried putting a \ in front of the $ also and made no difference.

use " instead of '.  inside ', a $ is just a literal.  inside ", $NAME 
gets substituted.



-- 
john r pierce, recycling bits in santa cruz




More information about the CentOS mailing list