Thanks!
The codepieces are slow -
lets speed them up with a bit extra code.
Some timings.
The codepieces are one-liners in production -
but may be easier reads this way.
Copy code into terminal -pres enter.
I am on
#Fatdog 812
#Bash 4.4.18
#gawk 5.1
The codepieces for /bin/echo and busybox echo
should work for you.
#For reference
Code: Select all
#GAWK strtonum
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
printf "%c\t%s\n", strtonum( "0x" d),d;next};{exit}'
real 0m0.011s
user 0m0.013s
sys 0m0.005s
#
Code: Select all
#TOO MANY MISKO
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '/\/x/ {if(NR>41 && NR<138) {gsub(/\/x/, "", $2); cmd = "echo $((0x"$2"))";cmd;close(cmd, "to"); cmd |& getline out; printf "%c %s\n", out, $2; close(cmd);}}'
real 0m0.332s
user 0m0.260s
sys 0m0.104s
####################################
####################################
Code: Select all
#TOO MANY (bash) echo -e
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
str="\\\\x" d "\t" d;
system("echo -e " str);next};
{exit}'
real 0m0.318s
user 0m0.248s
sys 0m0.081s
Code: Select all
#TOO MANY /bin/echo -e
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
str="\\\\x" d "\t" d;
system("/bin/echo -e " str);next}
{exit}'
real 0m0.511s
user 0m0.388s
sys 0m0.133s
Code: Select all
#TOO MANY busybox echo -e
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
str="\\\\x" d "\t" d;
system("busybox echo -e " str);next}
{exit}'
real 0m0.547s
user 0m0.380s
sys 0m0.176s
###############################
###############################
Speed-stripes coming up:
Code: Select all
#BULK (bash) echo -e
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
str=str "\\\\x" d "\t" d "\n";next};
{exit}END {cmd="echo -en " "\"" str "\"";system(cmd);}'
real 0m0.015s
user 0m0.017s
sys 0m0.008s
#
Code: Select all
#BULK /bin/echo -e
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
str=str "\\\\x" d "\t" d "\n";next};
{exit}END {cmd="/bin/echo -en " "\"" str "\"";system(cmd);}'
real 0m0.015s
user 0m0.018s
sys 0m0.007s
Code: Select all
#BULK busybox echo -e
time zcat /usr/share/i18n/charmaps/UTF-8.gz | awk '(NR < 42){next};((NR < 138) && ( $2 ~ /\/x/ )){d=substr($2,3);
str=str "\\\\x" d "\t" d "\n";next};
{exit}END {cmd="busybox echo -en " "\"" str "\"";system(cmd);}'
real 0m0.015s
user 0m0.017s
sys 0m0.009s
#