help with sh script

Giorgos Keramidas keramida at ceid.upatras.gr
Sun Jul 3 22:24:51 GMT 2005


On 2005-07-03 09:39, fbsd_user <fbsd_user at a1poweruser.com> 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.

There are many ways:

echo "${raw_ip}" | sed -e 's/\.//g'
echo "${raw_ip}" | perl -pe 's/\.//g'
echo "${raw_ip}" | awk -F. '{gsub("\\.", ""); print}'



More information about the freebsd-questions mailing list