I'm trying to write a ksh script which will allow me to to search for yesterday's date within a rtf file. I just need someway to know if the date is in the file, echo results to a text file, and then mail that out.
The format of the date is mm/dd/yyyy.
I had to make a variable for the date I'm searching for since "yesterday's date" can vary.
If this script is ran 5pm-midnight EST I need to look for the current date.
If ran after midnight but before 5pm, I will need to look for yesterday's date.
I have simplified the file names and paths for compliance reasons, but right now I have:
I'm getting the error "syntax error at line 25 : `>' unexpected" (the line I bolded) after the second if statement when I try to echo results to a text file.
Does anyone know what the issue is? Thanks in advance!
Also let me know if I need to clarify anything, I'm a new programmer.
Jay
Last edited by joeyg; 11-26-2012 at 02:33 PM..
Reason: Please wrap data and sripts with CodeTags
Input:
|Running the Rsync|Sun Oct 16 22:48:01 BST 2016
|End of the Rsync|Sun Oct 16 22:49:54 BST 2016
|Running the Rsync|Sun Oct 16 22:54:01 BST 2016
|End of the Rsync|Sun Oct 16 22:55:45 BST 2016
|Running the Rsync|Sun Oct 16 23:00:02 BST 2016
|End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)
Hi,
I have a requirement to find a file based on date stamp provided by user. In one of the shared location I get data file say “datafile<dataformat>“. And User will provide the date based on which I need to select a file which is 7 days older, if a file not present within 7 days, then I need... (3 Replies)
Hi All,
I want to grep through all the log files created from 20th August. How do I do that? My script will run everyday. So it will take current date as To_Date.
My log file name looks like - applog-2012-08-20-000001....applog-2012-08-20-000002...etc.
Thanks in advance. (5 Replies)
Hello I would like to ask for help with a script to search a directory that contains many log files and based on a users input after being prompted, they enter a date range down to the hour which searches the files that contain that range.
I dont know how to go about this. I am hoping that the... (5 Replies)
I like "ls -ltr".
I would like to search for a file in a large directory recursively and and display all the candidates in reverse order.
/usr/bin/find . -name \*.txt
This works.
How do I display the date and sort the file names by the date in reverse order for the entire directory... (1 Reply)
Hi,
Currently I am working on a script to automate the process of converting the log file from binary into text format. To achieve this, partly I am depending on my application’s utility for this conversion and the rest I am relying on shell commands to search for directory, locate the file and... (5 Replies)
I am viewing a file in vi editor and would like to search for a date pattern. In the log, the timestamp is enclosed in parentheses ''. I am using the '/' option in vi to search for the pattern.
log snippet:
000000f4 ServletWrappe I SRVE0242I: : Initialization successful.
000000f4... (3 Replies)
I am very new to Perl. I am struggling so hard to search a date (such as 10/09/2009, 10-09-2009) from a text file and replace with a string (say DATE) using Perl. Please help me out. Thanks in advance.
Regds
Doren (4 Replies)
Hi,
How can we search for a file with current date(sysdate).
Actually i want the file name from a directory which was created today(current date).
For example i have a dir /home/arch and i have files with name aglito03axyz.datetimestamp in this directory, but all these files were created... (7 Replies)
Hey Guyz I have a requirement something like this..
a part of file name, date of modification of that file and a text is entered as input.
like
Date : 080206 (MMDDYY format.)
filename : hotel_rates
text : Jim
now the file hotel_rates.ZZZ.123 (creation date is Aug 02 2006) should be... (10 Replies)