#!/bin/sh
#
# (by) Jindra Flídr
#
# $DevNullCZ: ukol-09.reseni.awk.txt,v 1.1 2005/04/26 21:00:03 jp Exp $
#

echo "$*" > tmp1

awk "
BEGIN {FS=\"/\"; }
{
vystup=\"\"; pocet=\$2;
split(\$1,ip,\".\");
for (i=1;i<=4;i++) {
    cislo=0;
    for (n=128;n>=1;n/=2) {
        if (pocet>0 && ip[i]>=n) {
            cislo+=n;       
            ip[i]-=n;
        }; pocet--;
    }
    if (i<4) {vystup=vystup cislo \".\";} else {vystup=vystup cislo;}
}
print vystup \"/\" \$2;
} " tmp1

rm tmp1