Thanks for the info I didn't realize. How do you call this Korn shell? Is it #! /usr/bin/korn
Also, how do you get the date in dd mmm yyyy format? For example 26 Mar 2012?
This list provides index to the abbr month name. The 4th column returns from the 'localtime' will give the index of the month. Eg. 2 means Mar. List index starts from 0
localtime is a Perl built-in function that returns second, minute, hour, ..... In our case, we only need the day of the month ($mday), month ($mon), and year ($yr). 946656000 is the epoch time for 2000-01-01, we just need to add the additional seconds for the input days
$yr returns 100 for year 2000, therefore we need to add 1900. Also, we need the month in abbr form and therefore we need to refer to the value based on the position in the list @M
Thanks for the info I didn't realize. How do you call this Korn shell? Is it #! /usr/bin/korn
Also, how do you get the date in dd mmm yyyy format? For example 26 Mar 2012?
My preference is #!/usr/bin/env ksh which will invoke it provided the binary is in a directory specified in your PATH. I use this method because I believe it is more portable and on most of my systems I build the latest version of Kshell and install it outside of the system default (/usr/bin/ksh or /usr/local/bin/ksh); I want to ensure that I'm invoking my build rather than the version that was included in the distribution.
I need to change Date and time stamp format from Jan 01 2015 11:00:00 PM to 01/01/2015 23.00.00
Existing Format : Mon DD YYYY hh:mi:ss AM/PM (Jan 01 2015 11:00:00 PM)
Expected Format: MM/DD/YYYY hh.mi.ss 24 hours (01/01/2015 23.00.00)
I need to update enitire file where... (3 Replies)
I have the following perl one-liner to get yesterday's date, but I would like it in the form of dd-MMM-yy (for example: 01-JAN-12). Can someone alter the below code so I get the format I want? Also, could someone also give me a line for dd-Mmm-yy (for example 01-Jan-12)?
Code:
YEST=`perl -w... (3 Replies)
I need to be able to compare dates in the format of Jan 10, 2012 and Jan 10 2012. (Notice one has a comma).
Then I need to find the date that is 7 days before those dates if they are equal.
How can I do this in Bash.
Thank ahead (4 Replies)
I am unable to get this KSH script to work. Can someone help. I've been told this should work with KSH93. Which I think I have on Solaris 10.
If I do a grep -i version /usr/dt/bin/dtksh I get
@(#)Version M-12/28/93d
@(#)Version 12/28/93
@(#)Version M-12/28/93
This is correct for... (5 Replies)
Hi all,
I require to convert julian date to normal calander date in unix
for eg julian date=122
now i want corresponding calander date
----------------------------------------
gr8 if give very small command/script
and please explain the steps as well(imp)
Thanks
... (3 Replies)
I want to calculate the date of next satureday of current date using shell script.
Suppose, today is 27-feb-08
I want to get the date of next satureday, which means 01-mar-08, in the formate '' YYMMDD ".
I do this in ksh..
Please tell me any type of command which help me out.
Thanks in... (3 Replies)
I'm using AutoSys as scheduler for my application.
I maintain a calendar in AutoSys which specifies when a job should run. A unix shell scripts runs on the days spceified by calendar and processes incoming files.
These incoming files contain dates embedded in the filenames.
My job needs to... (2 Replies)
I need Unix, ksh scripts that will convert dates - Gregorian to Julian and Julian to Gregorian.
Input for converting Gregorian to Julian would be in the form of CCYYMMDD with the output being CCYYDDD.
Input for converting Julian to Gregorian would be CCYYDDD with the output being CCYYMMDD.
... (4 Replies)