unix - Replacing a string with special characters -


i trying replace set of characters within variable.

var1=''abcd'' 

i want replace ''' pipe looks like.

|abcd|

i have tried below.

var1=$(sed 's/&apos;/|/g' <<< $var1) 

but not working. kindly me out.

edit: original answer incorrect formatted question.

this works

var1=$(echo "${var1}" | sed 's/&apos;/|/g') 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -