Can someone help me to convert a hexadecimal number to decimal number in a shell script?
E.g., I want to convert the hexadecimal number bfca3000 to deci
I have this handy script on my $PATH to filter 0x1337-like; 1337; or "0x1337" lines of input into decimal strings (expanded for clarity):
#!/usr/bin/env bash
while read data; do
withoutQuotes=`echo ${data} | sed s/\"//g`
without0x=`echo ${withoutQuotes} | sed s/0x//g`
clean=${without0x}
echo $((16#${clean}))
done