#!/bin/sh
emoji="U1f300-U1f5ffU1f900-U1f9ffU1f600-U1f64fU1f680-U1f6ffU2600-U26ffU2700-U27bfU1f1e6-U1f1ffU1f191-U1f251U1f004U1f0cfU1f170-U1f171U1f17e-U1f17fU1f18eU3030U2b50U2b55U2934-U2935U2b05-U2b07U2b1b-U2b1cU3297U3299U303dU00a9U00aeU2122U23f3U24c2U23e9-U23efU25b6U23f8-U23fa"
sample="This ???? is ⭐ a ???? line ???? of ???? emoji ✈"
echo $sample
echo $sample | LC_ALL=UTF-8 sed -e "s/[$(printf $emoji)]//g"
The preceding script can obtain normal execution results on other Linux operating systems (such as centos). However, if the script is executed on OpenWRT, an error message is displayed sed: bad regex Invalid character range or the correct result cannot be obtained after execution. Attempts were made to change the sed version to 4.8 but the problem persisted. Is this bash or is the system environment incomplete?
- Attempts were made to change the sed version to 4.8 but the problem persisted
- emoji=”U1f300-U1f5ff” Trying to shorten emoji also works on centos, not openwrt