Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Jul 2005 19:23:57 +0200
From:      FreeBSD questions mailing list <FreeBSD@amadeus.demon.nl>
To:        "freebsd-questions@FreeBSD. ORG" <freebsd-questions@freebsd.org>
Subject:   Re: help with sh script
Message-ID:  <334F6B97-E8F8-448D-B102-FCF0DBFAE474@amadeus.demon.nl>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGOEBGHIAA.fbsd_user@a1poweruser.com>
References:  <MIEPLLIBMLEEABPDBIEGOEBGHIAA.fbsd_user@a1poweruser.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 03 jul 2005, at 17:18, fbsd_user wrote:

>
>
> On 03 jul 2005, at 15:39, fbsd_user wrote:
>
>
>>> What is the sh coding to strip the periods from a IP address??
>>>
>>>
>>> raw_ip='10.0.10.5'      this is starting
>>> num_ip='100105'        and this is what I need to convert to.
>>>
>>>
>>>
>>>
>> Hi,
>> many ways, here's one:
>>
>> printf '10.0.10.5' | sed 's/\.//g'
>>
>> Arno
>>
>
> *****************************************
>
> Thanks but I need a little more help.
>
> num_ip="(printf $raw_ip | sed 's/\.//g')"
>
> gives me a error.
>
> What would the correct syntax be?
>
> I am trying to write script to insert rules into PF firewall
> on 5.4. using pf anchors.
>
>
>


you forgot the " " around the printf argument:

num_ip=" `printf "$raw_ip" | sed 's/\.//g' ` "


Arno




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?334F6B97-E8F8-448D-B102-FCF0DBFAE474>