Or you could store the last few lines in temp file and run nawk on it
Hi kumaran_5555,
if i understand you correctly here, you would be replacing the whole of:
while [ "${SUCCESS}" = "FAILED" ]
do
LOGINFO="`/usr/bin/cat "${LOGFILE_NBU}" | /usr/bin/nawk \
'BEGIN{
last_line="";
}
{ # Main
if ($0 != ""){
last_line=$0;
}
} # end of Main
END{
printf("%s",last_line);
}'`"
if [ "${LOGINFO}" != "" ]
then
with just:
tail -5 log_file.txt|while read line
do
echo $line | /usr/bin/nawk \
'BEGIN{
tsys_success="";
success="";
fla_backup=0;
fla_success=0;
number=0;
m=0;
}
{ # main
number=(split($0,arr00,""));
for (m=1; m <= number; m++){
if (index(arr00[m],"User_")>0){
fla_backup=1;
}
if (index(arr00[m],"essfull")>0){
fla_success=1;
}
if ((fla_backup==1) && (fla_success==1)){
success="OK";
printf("%s",success);
}
else{
success="FAILED";
printf("%s",success);
}
} # for loop
}'`" # end of main
fi
I am lost here...?
Thanks for giving me a heads up
hi friends
I need a shell script which will do the following Task
Enter the month :
if you enter 1 then it ll show you last 1 month's (starting from today).log file in the current directry.
if you enter 4 then it ll show you last 4 month's (starting from today).log file in the current... (2 Replies)
hi
iam new of the ksh script.iwant in formation of how to call in logfile in
ksh scripts. if the meaning in ksh.
please help me
thanks
naveen.g (1 Reply)
I thought I was pretty handy with awk until I got this one. :)
I'm trying to parse a log file where the events could have different delimiters (2 scripts is ok), the errors are spread over multiple lines, and I"m trying to figure out how to not read the same lines that have already been read. ... (1 Reply)
Hi,
I have a log file like exyymmdd.log and i need to do is read the log file and inside the logfile if i find the word which starts with PQR002106570.book then i need to replace the value of PQRXXX.book(this is unique) with its corresponding title. A list of id(PQRXXX.book) and its title are... (5 Replies)
I cannot get anything to go to my log. This is what i see on my screen when i run my korn shell.
cd ok, cwd=/export/home/tsp_inst/TSP
pget: /nas4/edata/tsp/rawdata/test2.gz: File exists
But i cant get it to write it to my log.
cd /this/is/my/newdirectory
lftp -e 'pget -c -n 4... (1 Reply)
Hi,
I need to continuously monitor a logfile to get the log information between a process start and end.
the logfile look like this
abcdddddddddd
cjjckkkkkkkkkkkk
abc : Process started
aaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbb
abc... (6 Replies)
Dear all,
I have small script which seems to be working but seems to have some bug.
It suppose to read commonTxt and then print the noOfLines in outputFile.
It is working for most of the txt but unable to add some of the variables values.
Can somebody please spend looking at the thread and... (2 Replies)
Hi Team,
Have to write a shell script to pick only 1 hr logs from the generated logfile and send it to other logfile.
Thanks & Regards,
Indu (3 Replies)
Bonjour,
I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things.
The script use the following technique :
tail -fn0 $logfile | \
while read line ; do
... some stuff
done
First one, I'd like a way to end the monitoring script if a... (3 Replies)
Hi,
I have logfile like this..
=== 2014-02-09 15:46:59,936 INFO RequestContext - URL: '/eyisp/sc/skins/EY/images/pickers/comboBoxPicker_Over.png', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko': Unsupported with Accept-Encoding header
=== 2015-02-09... (8 Replies)
Discussion started by: kishk
8 Replies
LEARN ABOUT X11R4
exit
exit(1) User Commands exit(1)NAME
exit, return, goto - shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps
SYNOPSIS
sh
exit [n]
return [n]
csh
exit [ ( expr )]
goto label
ksh
*exit [n]
*return [n]
DESCRIPTION
sh
exit will cause the calling shell or shell script to exit with the exit status specified by n. If n is omitted the exit status is that of
the last command executed (an EOF will also cause the shell to exit.)
return causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command exe-
cuted.
csh
exit will cause the calling shell or shell script to exit, either with the value of the status variable or with the value specified by the
expression expr.
The goto built-in uses a specified label as a search string amongst commands. The shell rewinds its input as much as possible and searches
for a line of the form label: possibly preceded by space or tab characters. Execution continues after the indicated line. It is an error to
jump to a label that occurs between a while or for built-in command and its corresponding end.
ksh
exit will cause the calling shell or shell script to exit with the exit status specified by n. The value will be the least significant 8
bits of the specified status. If n is omitted then the exit status is that of the last command executed. When exit occurs when executing
a trap, the last command refers to the command that executed before the trap was invoked. An end-of-file will also cause the shell to exit
except for a shell which has the ignoreeof option (See set below) turned on.
return causes a shell function or '.' script to return to the invoking script with the return status specified by n. The value will be the
least significant 8 bits of the specified status. If n is omitted then the return status is that of the last command executed. If return
is invoked while not in a function or a '.' script, then it is the same as an exit.
On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways:
1. Variable assignment lists preceding the command remain in effect when the command completes.
2. I/O redirections are processed after variable assignments.
3. Errors cause a script that contains them to abort.
4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari-
able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not
performed.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO break(1), csh(1), ksh(1), sh(1), attributes(5)SunOS 5.10 15 Apr 1994 exit(1)