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

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

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -