OTP-sh/byte2dec.sh

13 lines
223 B
Bash

byte2dec() {
printf "%s" "$1"|
od -A n -t d1|
tr -s "[:blank:]" "\n"|
tail -n +2|
while read i;do
echo "$i"|
awk '/^[^-]/{printf("%03d ", $0);};\
/^-/{print 256-substr($1,2)}'|
tr "[:space:]" " ";
done
}