Unix/Linux Go Back    


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

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 09-18-2012   -   Original Discussion by SarwalR
SarwalR's Unix or Linux Image
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 04:55 AM.. Reason: Please use code tags for data and code samples
Sponsored Links
    #2  
Old Unix and Linux 09-18-2012   -   Original Discussion by SarwalR
rdrtx1's Unix or Linux Image
rdrtx1 rdrtx1 is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 27 November 2017, 6:33 AM EST
Location: Houston, Texas, USA
Posts: 983
Thanks: 0
Thanked 338 Times in 319 Posts

Code:
 
tail logfile | grep ":.*:" | awk '{printf $1 " ";} END {print "";}' | read d1 d2
[[ $d1 = $d2 ]] && run_second_script

Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 03: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 02:42 AM
simplify the script, check field match to value in a file jimmy_y Shell Programming and Scripting 6 05-25-2010 04:40 AM
Match File and Copy File Script (Homework, Closed) teteguru1 Shell Programming and Scripting 4 10-04-2009 06:21 AM
Need script to generate all the dates in DDMMYY format between 2 dates frozensmilz Shell Programming and Scripting 2 01-29-2009 06:06 AM



All times are GMT -4. The time now is 10:18 PM.