[SOLVED] stop sed from replacing unicode hex characters
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The first command gives the the variable in the required format. However, when I go to insert it into isolinux.cfg, at that point sed replaces the unicode hex string with an ascii space. I guess I just shouldn't bother with changing to unicode hex when I create the variable. Go ahead an insert it with sed, then issue a second sed command to change those two spaces to the unicode hex. That seems like the most expedient way to do it.
I think you need to define what unicode character set you are using. I don't think its sed's fault.
The echo command displays as posted because escape characters are not interpreted by default. The -e option enables escape characters and therefore compare the outputs:
echo ${LABEL}
versus
echo -e ${LABEL}
Since I am a native English speaker I have not paid enough attention character sets. It depends on what unicode character set you are using, what application you are using to view the file and how it interprets the characters. Many unicodes sets are backwards compatible with ASCII and therefore \x20 is a space.
As I had time to think a bit more I would refrain from using spaces the disk label. Maybe underscore or a hyphen.
By default, the inst.stage2= boot option is used on the installation media and set to a specific label (for example, inst.stage2=hd:LABEL=RHEL7\x20Server.x86_64).
I had to go back to the documentation... Hmm, it does show a space... I agree with pan64 that a double \\ should work.
MyISO="${1-/path/to/default.iso}"
#
# ...
#
if [[ ${LABEL} ]]
then
sed "/^label linux/ i $(Entry)" isolinux.cfg
else
echo "failed to probe ${MyISO}"
fi
#
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.