Unverified Commit 4e8ef365 authored by David Beniamine's avatar David Beniamine
Browse files

Fix registry avoid duplicate lines

parent e851a532
......@@ -47,16 +47,15 @@ do
date=$(date +%Y%m%d)
rIP=$(echo $line | cut -d ' ' -f 3)
sline=$(echo $line | cut -d ' ' -f 1-2)
mac=$(echo $line | cut -d ' ' -f 1)
eline=$(echo $line | cut -d ' ' -f 4-)
res=$(grep "$sline" $conf_file)
res=$(grep "$mac" $conf_file)
if [ ! -z "$res" ]
then
# Update
sed -i -e "s/^.*$sline.*$/$date $sline $eline/" $conf_file
else
# Add
echo "$date $line" >> $conf_file
sed -i "/$mac/d" $conf_file
fi
echo "$date $line" >> $conf_file
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment