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

android - questions about switching from C2DM to GCM -

c++ - Qt setGeometry: Unable to set geometry -

batch file - How to extract all multi-volume RAR archives from subfolders of a folder? -