Wednesday, June 28, 2006

converting hex to binary


I can never remember the syntax to convert numbers between various bases with bc, and end up looking at the man page. 


Here is an example of using bc to convert a hex number to binary.




bash$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
ibase=F
obase=2
01EA

110111101



Technorati Tags: