From 12f3e1e371fec92b84b710ee888b4e2d458e2f28 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 28 Jan 2009 11:19:20 +0100 Subject: [PATCH] allow command line parameter, some cleanup Signed-off-by: Nico Schottelius --- mac-adresses-csv-to-dhcpd.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mac-adresses-csv-to-dhcpd.sh b/mac-adresses-csv-to-dhcpd.sh index a5520ca..f01ffb1 100755 --- a/mac-adresses-csv-to-dhcpd.sh +++ b/mac-adresses-csv-to-dhcpd.sh @@ -1,8 +1,11 @@ #!/bin/sh -file="$1" sep=';' name='dryad' +hostname="$1"; shift +ipnbase="$1"; shift +field="$1"; shift +file="$1"; shift awk "-F$sep" 'BEGIN { hc=1; @@ -23,11 +26,11 @@ awk "-F$sep" 'BEGIN { /^S-09/ { - mac = mac2dp($2) - print " host dryad" hc \ - " {\n hardware ethernet " mac - ";\n fixed-address 192.168.54." - i - ";\n }"; + mac = mac2dp($field); + print \ + " host " hostname hc " {\n" \ + " hardware ethernet " mac ";\n" \ + " fixed-address " ipnbase hc ";\n" \ + " }"; hc++; - }' < "$1" + }' ipnbase="$ipnbase" field="$field" hostname="$hostname" < "$file"