Using BusyBox shell, sed can't parse regex

you should probably provide an English translation of your post, too ...

From the translation, it still seems the OP doesn't acknowledge this is a script, and not an app.

They merely want to discuss why sed didnt work and grep did.

I agree, the OP has left the conversation.

Your understanding is completely wrong. It seems that your translation software is no better than mine

1 Like

opkg install bash
opkg install sed

I have followed your suggestions and steps before and the problem does exist. I am ready to give up the invalid question here

then it's a firmware specific issue, and as already posted by @psherman, you're not using vanilla Openwrt.

you need to ask your provider.

1 Like

I don't think you should take your answer post #49 as final because it didn't work

.... for you.

you're barking up the wrong tree.


After installing bash, have you tried running the commands in the actual bash? Because that works flawlessly for me:

root@Jupiter-Main:~# opkg install bash
Installing bash (5.2.15-1) to root...
Configuring bash.
root@Jupiter-Main:~# bash
root@Jupiter-Main:~# emoji="\U1f300-\U1f5ff\U1f900-\U1f9ff\U1f600-\U1f64f\U1f680-\U1f6ff\U2600-\U26ff\U2700-\U27bf\U1f1e6-\U1f1ff\U1f191-\U1f251\U1f004\U1f0cf\U1f170-\U1f171\U1f17e-\U1f17f\U1f18e\U3030\U2b50\U2b55\U2934-\U2935\U2b05-\U2b07\U2b1b-\U2b1c\U3297\U3299\U303d\U00a9\U00ae\U2122\U23f3\U24c2\U23e9-\U23ef\U25b6\U23f8-\U23fa"
root@Jupiter-Main:~# sample="This 🍒 is ⭐ a 🐢 line 🤮 of 😃 emoji ✈"
echo $sample
This 🍒 is ⭐ a 🐢 line 🤮 of 😃 emoji ✈
root@Jupiter-Main:~# echo $sample | LC_ALL=UTF-8 sed -e "s/[$(printf $emoji)]//g"
This  is  a  line  of  emoji

Edit: And if you're trying to run your script, don't forget to adjust your shebang. It should now read #!/bin/bash instead of #!/bin/sh.


Completely follow the above steps, the only difference is that I have not upgraded the system to 23.05, I have prepared to give up this question, so this is no longer important and do not prepare to upgrade the system. Even after upgrading the system can achieve the effect, but after all, this solution is for the new version of the system, so I think it is not appropriate to end with this method! But it doesn't matter

1 Like

@psherman can we get this thread locked, this isn't leading anywhere ...


In sed, the op has \Uxxxx, meaning "UtfCode"
But in grep he has \x{xxxx}, meaning "hex string".

Busybox ASH does not have to support mappings of utf codes to pixel bitmaps of characters as OpenWrt does not need it. Note it is the terminal program/ browser/ etc on the user's machine that does the code_to_pixel_bitmap translation from the utf database (a database that does not exist on OpenWrt).

So, most likely if the sed regex was changed to the hex version it would work. I haven't tested it......


Also cross-posts