stop sed from replacing unicode hex characters
by bradvan from LinuxQuestions.org on (#4VBKW)
I have a variable with some unicode hex characters: Code:LABEL=$(blkid CentOS-7-x86_64-DVD-1810.iso | awk '{ print $2, $3, $4 }' | sed -e 's| | \\x20|g' | sed -e 's|"||g") which results in: Code:echo ${LABEL}
LABEL=CentOS\x207.6\x20x86_64 Now, I want to insert that in a file: Code:sed -e "/^label linux/ i label kickstart\n menu label ^Kickstart CentOS 7\n kernel vmlinux\n append initrd=initrd.img inst.stage2=hd:${LABEL} inst.ks=cdrom:/ks.cfg\n" isolinux.cfg which changes the unicode hexCode:\x20 back to a space. Any ideas on how to keep that from happening?


LABEL=CentOS\x207.6\x20x86_64 Now, I want to insert that in a file: Code:sed -e "/^label linux/ i label kickstart\n menu label ^Kickstart CentOS 7\n kernel vmlinux\n append initrd=initrd.img inst.stage2=hd:${LABEL} inst.ks=cdrom:/ks.cfg\n" isolinux.cfg which changes the unicode hexCode:\x20 back to a space. Any ideas on how to keep that from happening?