Home Man
Search
Today's Posts
Register

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

Tags
shell scripts

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 09-18-2012
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
# 2  
Old 09-18-2012
Code:
 
tail logfile | grep ":.*:" | awk '{printf $1 " ";} END {print "";}' | read d1 d2
[[ $d1 = $d2 ]] && run_second_script

Login to Reply

« Previous Thread | Next Thread »
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 validate dates inside a file dattatraya Shell Programming and Scripting 2 02-20-2015 01:53 PM
Need Help:Shell Script for Solaris to change the dates in a file by one week sriramanaramoju Shell Programming and Scripting 3 11-20-2013 04:48 AM
Perl read file with dates in ab52 Programming 8 05-30-2013 04:37 PM
script to match statement from a file anshu ranjan Shell Programming and Scripting 2 08-20-2011 02:18 AM
script to read XML file murtujak Shell Programming and Scripting 1 05-25-2011 06:57 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
how to read dbf file in shell script and to convert dbf file usinf shell script gauara Shell Programming and Scripting 6 05-12-2009 10:25 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 01:44 AM.

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