Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Jun 2001 03:14:47 -0500
From:      Mike Meyer <mwm@mired.org>
To:        Dan Busarow <dan@dpcsys.com>
Cc:        tyler spivey <tspivey8@home.com>, questions@FreeBSD.ORG
Subject:   Re: program to convert hex to decimal or vise versa?
Message-ID:  <15157.41335.592281.637560@guru.mired.org>
In-Reply-To: <Pine.BSF.4.21.0106240039000.86457-100000@java2.dpcsys.com>
References:  <15157.26660.156190.806500@guru.mired.org> <Pine.BSF.4.21.0106240039000.86457-100000@java2.dpcsys.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Dan Busarow <dan@dpcsys.com> types:
> On Jun 23, Mike Meyer wrote:
> > tyler spivey <tspivey8@home.com> types:
> > > is their a program in ports that i can use
> > > to convert hex to dec or vv? i don't use x
> > > and want a command line based app.
> > Ports nothing. bc is in the base system. I've added prompts for
> > clarity, as it doesn't prompt.
> I was going to suggest bc too but the questioner required scripts.
> Crist had the answer for him and taught me something new too.
> printf(1)  who came up with that?   And when?  

I didn't see anything about scripts, but bc can do that as well:

	guru$ echo 'ibase = 16; 1A' | bc
	26

Not having to deal with prepending 0x may or may not be an advantage.

		<mike	
--
Mike Meyer <mwm@mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15157.41335.592281.637560>