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.
so if a good log that does not get TIMEOUT looks like that :
if some ip gets timeout and gets to the 'continue' the log is written like that :
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 :
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
Moderator's Comments:
Please use CODE tags correctly as required by forum rules!
Last edited by RudiC; 08-20-2018 at 04:49 AM..
Reason: Changed QUOTE to CODE tags.
Is that reproducible or a sporadic behaviour?
Is that $LOG file being written to elsewhere?
What is that continue for?
Hey,
LOG is simply a file /tmp/zabbix.csv that after the script i can atteched to email
continue acts like that -
if there is a time out on some IP it does no continue all the loop with this ip
and continue to next ip .
as this script has more commands after that block
but if i get timeout there is no need for me to do all the loop with this ip
as ill get timeout 5 times. so its continueing to the next ip in the file $HOST
Your echo -n suppresses the line terminator (to be added by the zabbix_get later), and the sed script doesn't add it either. Try adding a \n after the "TIMEOUT" string in your sed command.
Guys i need an idea for one logic..in shell scripting am struggling with a logic...So the thing is... i need to search for a word in a huge log file and i need to continue to print few more lines from that line and the consecutive line has to end when it finds the line with date..because i know... (1 Reply)
Hello everyone
I was hoping someone could tell me whether I can use a wildcard inside an tcsh if statement.
I am trying to test the argument the user has fed the script and whether it is a .txt file.
The Ides behind it is the following
if (`echo $1` != *.txt) then
echo "wrong... (6 Replies)
Hello,
I have a very long instruction to write, but, for lisibility reasons, I would like to cut it on more than one line and comment each lines.
is it possible ?
thanks :b: (1 Reply)
I have a script that runs a console/terminal command on the server and what is want is for each of the multiple success reports fed back from the clients (echo-ed out onto the conosle) to be counted and after x number of reports reboot the server.
The Details:
The command (program) is... (0 Replies)
HI ,
I am new to the perl , I am using a if condition and in that if condition i am checking 7 variables value. so it continue to second line .And if i user "\" for the continue line it showing error.
Example :
if(a >9 || b>8 || c> 10 \
d > 11)
{
print();
}
The above statement is... (3 Replies)
I need to validate the special characters of a date (the characters between the year and month & month and day). The data filed is being populated by users and read into the script vi an argument. I want to ensure that the date is a '-' (dash) and not a '/' or '\' (slash).
The every thing I... (3 Replies)
Can someone tell me what exactaly the following command is doing -
pid_cmd="/usr/ucb/ps -axww | /usr/bin/egrep '${SUNMC2OSS_PATH}/SunMC2OSS\.jar.* sunmc2oss\.SunMC2OSS\$' | /usr/bin/egrep -v egrep | /usr/bin/nawk '{print \$1}'"
Is the egrep is to check "sunmc2oss.SunMC2OSS" process inside... (2 Replies)
hello
im working on a project for the iphone to write a termainal based program
we have bsd subsystem installed so have access to most unix command
i have a executable called coordinates, which get the coordinates of the iphone
when this runs it returns to the terminal the text of... (1 Reply)
I am looking to find something in the hour(in field $2) of 03:00:07 and 04:00:07 and 05:00:07 and must contain something in field 4... why doesn't below command work?
I try to use grep .. but since I am running this in loop, it's best I use the awk ..
can someone please advise.. I am pretty... (1 Reply)