Skip to content
Snippets Groups Projects
Verified Commit 4e8ef365 authored by David Beniamine's avatar David Beniamine
Browse files

Fix registry avoid duplicate lines

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