Shell Programming and Scripting

BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Script to read a log file and run 2nd script if the dates match

👤 Login to reply

 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-18-2012
SarwalR SarwalR is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 18 September 2012, 11:30 AM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Script to read a log file and run 2nd script if the dates match

Code:
# cat /tmp/checkdate.log
SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 17 22:49:00 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

FIRST_TIME           NEXT_TIME
-------------------- --------------------
16-SEP-2012 09:02:49 16-SEP-2012 09:47:15
16-SEP-2012 09:02:49 16-SEP-2012 09:47:15
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

Code:
# tail  /tmp/checkdate.log | grep "2012" | awk '{print substr($1,1,2), substr($1,4,3), substr($1,8,4)}'
16 SEP 2012
16 SEP 2012

I'm looking for a way to match date to day the script is ran. if the dates match i want it to start another script. can someone help me?

Roger

Last edited by Franklin52; 09-19-2012 at 03:55 AM.. Reason: Please use code tags for data and code samples
Sponsored Links
    #2  
Old 09-18-2012
rdrtx1 rdrtx1 is offline Forum Advisor  
Registered Pusher
 
Join Date: Sep 2012
Last Activity: 31 May 2018, 9:41 AM EDT
Location: Houston, Texas, USA
Posts: 1,142
Thanks: 0
Thanked 421 Times in 398 Posts
Code:
 
tail logfile | grep ":.*:" | awk '{printf $1 " ";} END {print "";}' | read d1 d2
[[ $d1 = $d2 ]] && run_second_script

Sponsored Links
👤 Login to reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
script to match statement from a file anshu ranjan Shell Programming and Scripting 2 08-20-2011 02:18 AM
how to convert a shell script to a php script for displaying next word after pattern match sb245 Shell Programming and Scripting 0 03-02-2011 01:42 AM
simplify the script, check field match to value in a file jimmy_y Shell Programming and Scripting 6 05-25-2010 03:40 AM
Match File and Copy File Script (Homework, Closed) teteguru1 Shell Programming and Scripting 4 10-04-2009 05:21 AM
Need script to generate all the dates in DDMMYY format between 2 dates frozensmilz Shell Programming and Scripting 2 01-29-2009 05:06 AM



All times are GMT -4. The time now is 07:09 PM.

Unix & Linux Forums Content Copyright©1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?