Hello,
im creating a csv file for email reporting on issues.
my problem is that after 'continue' command in if statment in a loop
the new paramter writing into the log doesnt take new line.
timeout 4s zabbix_get -I $ZBX -p $PORT -s $IP -k "system.run[grep "wheel" /etc/group]"
if [ $? -eq 124 ]; then
echo -e "$RED TIMEOUT $NC"
sed -i "/$IP/s/$/ ,TIMEOUT/" $LOG
continue
fi
so if a good log that does not get TIMEOUT looks like that :
IP,Wheel user,Note
192.168.1.1,root someuser1 someuser2
192.168.1.2,root someuser1 someuser2
if some ip gets timeout and gets to the 'continue' the log is written like that :
IP,Wheel user,Note
192.168.1.1,root someuser1 someuser2192.168.1.2, ,TIMEOUT
i need to make the new writen line in the log file as a new line
or tell the sed command somthing.
to make it look like that :
192.168.1.1,root someuser1 someuser2
192.168.1.2, ,TIMEOUT
i tried to look for an answer but couldnt find.
and i cant just add new line as it make an empty line in csv.
thanks