Need help on scripting

in unix bc command is used as calculator and also for conversion, i want to convert 5f to decimal. but bc dont consider 5f as hex value it considers 5F as hex value. I get 5f from other iteration so i cant change that f to F...is there any way to convert 5f to decimal ot 5f to 5F :rolleyes:

there are many methods to convert to upper, this is one of them

# echo '5f' | tr 'a-z' 'A-Z'

then you can get the result to pass to bc.
or

# awk '{print 0x5f}' file
95

there's also a recent discussion on converting hex to decimal in awk. you can search the forum for that.

This is bash...

typeset -i var=16#5f
echo $var

...ksh syntax is slightly different.