Sponsored Content
Top Forums Shell Programming and Scripting Compare different String in Log Files Post 302601993 by thermometer on Saturday 25th of February 2012 12:23:26 PM
Old 02-25-2012
Compare different String in Log Files

Hi Guys , sorry for my first post but a newbie here need some help on my simple scripts.

I have some scripts below that count the job started and the job finished
and is the job started and job finished equal ..then all job was successfully run and
finished on that day.

but sometime the was started ..and for some reason it restarted again
and my job finished and job started were not equal that day.

On this case.. I want an output which Job was not been finished on that day.

so far the scripts only gave me a comparison between job been started and finished.

any good idea how I can do this? thanks in advance.
[im sorry dont know what will be the appropriate title for this]


Log Files
Code:
2012/02/16 00:35:18   Job : Activity Started : Job123
2012/02/16 00:37:16   Job : Activity Started : Job125
2012/02/16 00:38:12   Job : Activity Started : Job126
2012/02/16 00:40:11   Job : Activity Started : Job127
2012/02/16 00:45:21   Job : Activity Started : Job123 
2012/02/16 01:07:26   Job : Activity Finished : Job125
2012/02/16 01:08:42   Job : Activity Finished : Job126
2012/02/16 01:15:51   Job : Activity Finished : Job127

notice the Job123 did not finished on this log

Script
Code:
#!/bin/ksh
JobLog=/Log/server.log

STARTCount=`grep "Job : Activity Started:" ${JobLog} | wc -1`
ENDCount=`grep "Job : Activity Finished:" ${JobLog} | wc -1`

if [[ ${STARTCount} != ${ENDCount} ]] ; then
     echo "Job NOT Completed..Start:${STARTCount} End:${ENDCount}" >> /Log/unsuccessfull.log

else
     echo "Job has been Completed" >> /Log/successfull.log
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

compare string in two files

i have two files: file1.txt AA BB DD EE file2.txt AA,AAA BB,BBB CC,CCC DD,DDD EE,EEE FF,FFF i want an output file: file3.txt AA,AAA BB,BBB (2 Replies)
Discussion started by: MiLKTea
2 Replies

2. Shell Programming and Scripting

Compare 2 log files

Hello, I am new here, so first of all I want say hello to everyone. I am newbie on script but you may be able to help me on this : I am on solaris (ksh) I need to compare 2 files (one_trash.log / two_arch.log) On the first file I've got like 1000 entries files name Ex of one_trash.log... (15 Replies)
Discussion started by: Aswex
15 Replies

3. Shell Programming and Scripting

Compare log files and get latest

I have a directory location where in some logs gets generated whenever some application build is triggered. I need to send the generated log as an email to end user. I will get files like abcyyyy_mm_dd_time.log and next file will have different time for same day. Need to run a cron and take the... (18 Replies)
Discussion started by: yogi90
18 Replies

4. Shell Programming and Scripting

String compare in multiple files

Hi I have a requirement to process number of files matching a criteria. The resulted file would be processed indivdually looking for a particular string until another one found lines afterwards. Then look for the occurrence of another string in the result count and display/return the result. ... (13 Replies)
Discussion started by: arungn
13 Replies

5. UNIX for Dummies Questions & Answers

Compare 2 files print the lines of file 2 that contain a string from file 1

Hello I am a new unix user, and I have a work related task to compare 2 files and print all of the lines in file 2 that contain a string from file 1 Note: the fields are in different columns in the files. I suspect the is a good use for awk? Thanks for your time & help File 1 123 232 W343... (6 Replies)
Discussion started by: KevinRidley
6 Replies

6. Shell Programming and Scripting

Compare columns of multiple files and print those unique string from File1 in an output file.

Hi, I have multiple files that each contain one column of strings: File1: 123abc 456def 789ghi File2: 123abc 456def 891jkl File3: 234mno 123abc 456def In total I have 25 of these type of file. (5 Replies)
Discussion started by: owwow14
5 Replies

7. UNIX for Dummies Questions & Answers

Search for string in a file then compare it with excel files entry

All, i have a file text.log: cover6 cover3 cover2 cover4 other file is abc.log as : 0 0 1 0 Then I have a excel file result.xls that contains: Name Path Pass cover2 cover3 cover6 cover4 (1 Reply)
Discussion started by: Anamika08
1 Replies

8. Shell Programming and Scripting

Compare the string in different files

Hi, There is a file A.txt which contains a list of strings. A.txt QASSBRK1 QASSBRK2 And in B.txt, command is written to generate output of dspmq with AWK script B.txt QMGR=`dspmq | awk '{print $1}' | cut -f2 -d "(" | cut -f1 -d ")"` Output of B.txt is QASSBRK1 QASSBRK2 QASSBRK3... (4 Replies)
Discussion started by: Anusha M
4 Replies

9. Shell Programming and Scripting

Two files String compare

file1.txt col1 col2 col3 b100:07-24-2018:test1 b102:04-24-2017:test2 b103:04-24-2017:test3 b104:04-24-2017:test3 file2.txt col4 col5 b100:name1@email.com b102:name2@email.com b103:name3@email.com Comparing string from file1.txt(col1) each record with... (3 Replies)
Discussion started by: ramgk5
3 Replies

10. UNIX for Beginners Questions & Answers

Concatenate a string and number and compare that with another string in awk script

I have below code inside my awk script if ( $0 ~ /SVC IN:/ ) { svc_in=substr( $0,23 , 3); if (msg_start == 1 && msg_end == 0) { msg_arr=$0; } } else if ( $0 ~ /^SVC OUT:/ ) { svc_out=substr( $0, 9, 3); if (msg_start == 1 && msg_end == 0) ... (6 Replies)
Discussion started by: bhagya123
6 Replies
ECACCESS-JOB-GET(1p)					User Contributed Perl Documentation				      ECACCESS-JOB-GET(1p)

NAME
ecaccess-job-get - Download a Job Output/Input/Error File SYNOPSIS
ecaccess-job-get -version|-help|-manual ecaccess-job-get [-debug] [-input|-error] [-encrypt] [-binary] [-bufsize length] job-id local-target-file DESCRIPTION
Allow downloading the Job Output/Input/Error Files with identifier job-id. The file is downloaded localy in the local-target-file. ARGUMENTS
job-id The identifier of the ECaccess Job to retrieve. local-target-file The name of the Local Target File. OPTIONS
-input By default the Job Output File is downloaded. Using this option allow downloading the Job Input File instead. -error By default the Job Output File is downloaded. Using this option allow downloading the Job Error File instead. -encrypt By default files are downloaded through the plain text channel (http). Using this option will force the download to occurs through the SSL secure channel (https). -binary By default files are downloaded as text files. This option will download files as binary files (decode_base64 required). Please note that text files can also be downloaded in binary mode but text mode is faster. You should use this option if your job output is containing non-text characters. -bufsize length Specify the length of the buffer (in bytes) which is used to download the file. The larger the buffer the smaller the number of http/s requests. By default a buffer of 524288 bytes(512KB) is used. -version Display version number and exits. -help Print a brief help message and exits. -manual Prints the manual page and exits. -debug Display the SOAP messages exchanged. EXAMPLES
ecaccess-job-get 124356 ./ecaccess-job-124356.output Download the output of the ECaccess Job 124356 in the local ecaccess-job-124356.output file. SEE ALSO
ecaccess-job-delete, ecaccess-job-list, ecaccess-job-restart, ecaccess-job-submit and ecaccess. perl v5.14.2 2012-04-16 ECACCESS-JOB-GET(1p)
All times are GMT -4. The time now is 02:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy