Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Mar 2000 18:57:56 +0000
From:      Brian Somers <brian@Awfulhak.org>
To:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
Cc:        Yoshinobu Inoue <shin@nd.net.fujitsu.co.jp>, freebsd-current@FreeBSD.org, brian@hak.lan.Awfulhak.org
Subject:   Re: IPv6 setup... 
Message-ID:  <200003141857.SAA01299@hak.lan.Awfulhak.org>
In-Reply-To: Message from Garrett Wollman <wollman@khavrinen.lcs.mit.edu>  of "Mon, 13 Mar 2000 10:13:31 EST." <200003131513.KAA35922@khavrinen.lcs.mit.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
> <<On Mon, 13 Mar 2000 10:22:08 +0900, Yoshinobu Inoue <shin@nd.net.fujitsu.co.jp> said:
> 
> >   echo 24.113.25.85 | sed -e s/"\."/" "/g | awk '{$5 = $1*256 + $2; $6 = $3*256 + $4; printf "2002:%x:%x:\n", $5, $6}'
> 
> Or, without only one extra process:
> 
> myaddr=24.113.25.85
> OIFS="$IFS"
> IFS=".$IFS"
> set $myaddr
> IFS="$OIFS"
> printf "2002:%x:%x:\n" $(($1 * 256 + $2)) $(($3 * 256 + $4))

Or if you wanna be really slick

myaddr=24.113.25.85
eval IFS=".$IFS" printf '2002:%02x%02x:%02x%02x:\\n' $myaddr

:*P

> -GAWollman
> 
> --
> Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
> wollman@lcs.mit.edu  | O Siem / The fires of freedom 
> Opinions not those of| Dance in the burning flame
> MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick

-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !




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




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