simpliest way to calculate octal?

Francesco Casadei fcasadei at inwind.it
Mon Nov 10 03:18:26 PST 2003


On Mon, Nov 10, 2003 at 02:35:35PM +0800, Zhang Weiwu wrote:
> Hello. Pretty newbie question again:)
> 
> Today I found I cannot calculate what is the octal form of 0xa04e.
> 
> First I thought xcalc should do the work, but it seems only deal with 
> decimal.
> 
> I have perl, tcsh, python interprater. It is likely that they are all 
> capable of this kind, but what are the commands for them? What's the most 
> convenient way?
> 
> _________________________________________________________________
> ???????? MSN Explorer:   http://explorer.msn.com/lccn  
> 
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> end of the original message

You can use 'bc' for this and other conversions:

$ echo 'ibase = 16; obase = 8; A04E' | bc
120116

ibase and obase are the input and output base respectively. Note that you
must use capital letters for exadecimal numbers, lower case letters are
variable names.
See bc(1) manual page for more information.

    Francesco Casadei
-- 
You can download my public key from http://digilander.libero.it/fcasadei/
or retrieve it from a keyserver (pgpkeys.mit.edu, wwwkeys.pgp.net, ...)

Key fingerprint is: 1671 9A23 ACB4 520A E7EE  00B0 7EC3 375F 164E B17B

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20031110/aca835e2/attachment.bin


More information about the freebsd-questions mailing list