Binary and hex in unix

not much familiar with binary and hex calculation in script programming....

explaination:

binary format control the parameter turned on or off in the program stored in hex mode, the question is:

how to change 39e to 19e using the binary calculation(although i don't know the command for binary calculation)

binary format:

11 1001 1110

hex format:

39e

just want to know any command in charge of this kind of calculation, thanks in advanced.

ksh can handle hex arithmetic. Try:

typeset -i16 val
val=16#39e
((val = val & 16#1ff))
echo $val

Ksh is not my favourite shell, so can someone give some example by use sh or csh?

anyway,much appreciate about the tips.