OTP-sh/count_bytes.sh

9 lines
150 B
Bash

count_bytes() {
printf "%s" "$1"|od -A n -t x1|
tr -s "[:space:]"|
sed -e "1s/[[:space:]]//"\
-e "s/.../&\n/g"|
tr -s "[:space:]"|
wc -l
}