Re: simpliest way to calculate octal?

2003-11-10 Thread Miguel Mendez
On Mon, 10 Nov 2003 14:35:35 +0800
Zhang Weiwu [EMAIL PROTECTED] wrote:

Hi,

 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?

How about: echo 0xa04e | awk '{printf %o\n,$1}'

Cheers,
-- 
Miguel Mendez [EMAIL PROTECTED]
http://www.energyhq.es.eu.org
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: simpliest way to calculate octal?

2003-11-10 Thread Francesco Casadei
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  
 
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 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



pgp0.pgp
Description: PGP signature


simpliest way to calculate octal?

2003-11-09 Thread Zhang Weiwu
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  

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]