What is the script in post #7 intended to do? Hard to guess from uncommented faulty code.
Are you trying to find out the age of each file or something?
Hi Methyl,
I have made the function which assigns numeric value to each mon.
then i am comparing the date of each file with todays date and i intend to gunzip all the files which are not of todays date.
comparison code i have removed for now,i m just tryin to print month date and filenames but its givin error related to arrays.
below is code for gunzipping files which is removed.
The code posted in post #9 does not tie up with the explanation. It appears to be code to gzip files rather than to gunzip files.
Are you actually trying to gzip files which are not dated today and which have not already been zipped?
Need to understand about your directory structure. I notice that you have ls -lar. Does this mean that there are files in subdirectories or would ls -la give exactly the same output?
Are you going to run this script manually or from cron. If it is to be run from cron daily, what time will it run?
I think that the script as posted does not work if any file is dated last year (which changes the format of ls -la). Consider what would happen if the script ran on Jan 1st .
Let's clear up what the script is meant to do, then look at a total rewrite.
Hi Methyl,
sorry for typo ,the code is for gzipping the files.
ls -lart gives same o/p as ls -lrt
absolutely corrct ,i am trying to gzip files older than today which are of a certain pattern.
I will be setting a cron for this which will run at 2300 hrs everyday.
My script comapres the month first with todays date,then the day.
this script will fail on 1st jan as jan is assigned a no. 1 which is less than 12(dec),
so all files for dec 31st will no get gzipped.
Total rewrite using find rather than ls .
Create a reference file timestamped at the start of day and then look for files of the right name which are older than the reference file.
Dear all,
I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date.
Expected output is :
31/03/2015
01/04/2015
02/04/2015
Note :
1. Im using aix and ksh
2. I have tried to convert the given input into a date, didnt... (0 Replies)
I am not able to pass date stored in a variable as an argument to date command. I get current date value for from_date and to_date
#!/usr/bin/ksh
set -x
for s in server ; do
ssh -T $s <<-EOF
from_date="12-Jan-2015 12:02:09"
to_date="24-Jan-2015 13:02:09"
echo \$from_date
echo... (7 Replies)
Hi,
I have date format in an excel sheet as 07/03/2014 11:21. I need to check this date with current date and need to find whether it is more than 30 days or not.
I know how to current date into days, but someone please help me to change the date in the excel sheet to days, so that i can check... (2 Replies)
Hi all,
I have used a bash script which ultimately converts a string into date using date --date option:
DATE=$DATE" "$TIME" "`date +%Y` //concatenating 2 strings
TMRW_DATE=`date --date="$DATE" +"%s"` //applying date command on string and getting the unixtime
Please use code tags... (7 Replies)
Hi,
I am trying to display future date from the current date but unable to do so in UNIX (not in PERL). For eg: if today is March 5 then I want a variable wherein I can store Mar 7 date, but unable to get the future date from the current date.
I have tried many possible ways as mentioned below... (11 Replies)
In KSH, I am pasting 2 almost identical files together and each one has a date and time on each line. I need to determine if the first instance of the date/time is greater than the 2nd instance of the date/time. If the first instance is greater, I just need to echo that line.
I thought I would... (4 Replies)
Hi,
I have script in unix which creates a julian date like 126 or 127
I want convert this julian date into calender date
ex : input 127
output 07/may/2007 or 07/05/2007 or 07/05/07
rgds
srikanth (6 Replies)