views:

59

answers:

1

Hi

how to convert Decimal to binary and viceversa

i am working on solaris10 platform

can anybody help me with a command

Decimal to Binary
4000000002-100000000000000000000000000010

Binary to decimal
100000000000000000000000000010-4000000002
+2  A: 

You can make use of the bc command for this.

For Decimal to binary, set obase to 2

echo 'obase=2;4000000002' | bc

For Binary to Decimal, set ibase to 2

echo 'ibase=2;100000000000000000000000000010' | bc
codaddict
thanks it's working
hi i have 2 crores record like this but the above command takes lot of time. any other command works faster than this