#!/bin/sh cp ${WORKSPACE}/template.168.192.in-addr.arpa.zone ${WORKSPACE}/$1.168.192.in-addr.arpa.zone grep "192\.168\.$1\.[0-9]\{1,3\}" ${WORKSPACE}/template.infoclinica.lan.zone|awk '{ print $1 " " $4 }' | while read name ip do last_octet=$(echo "${ip}"|awk -F"." '{print $4}') echo -e "${last_octet}\tIN\tPTR\t${name}.infoclinica.lan." >> ${WORKSPACE}/$1.168.192.in-addr.arpa.zone done sed -i "s/.*; serial.*/ $2 ; serial/" ${WORKSPACE}/$1.168.192.in-addr.arpa.zone