10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i am writing a ksh shell script to check the last month end date whether it is falling in last 10 week day date, I am not sure How to use "Mr. Perderabo's date calculator", Could you Please let me know how to use to get my requirement, I tried my own script but duplicate week day and... (5 Replies)
Discussion started by: karthikram
2. Shell Programming and Scripting
i have a file something like this :
and i want (end - start) total run time in below format:
00:15:00 (4 Replies)
Discussion started by: Acme
3. Shell Programming and Scripting
Totally newbie in scripting. And need helps in preparing a script to help me to do file moving, renaming and even delete.
I have 2 directories.
a) I will be getting new text files (e.g NewFile23052013.txt) created in the directory #1 every day... (1 Reply)
Discussion started by: quickerz
4. Shell Programming and Scripting
I was wondering the best way about finding files that were created today and copy them to a directory (grep ?). There can be multiple files for todays date or none. I am looking to copy all of the .lis files for todays date. I may need to modify the filename to include todays date but for the... (4 Replies)
Discussion started by: smkremer
5. Shell Programming and Scripting
I have a file with a field containing the following:
"7/3/2009 7:07:12 PM","xxxx"
I need to be able to split this field up into two into a different format with the time being converted into 24 hour:
so that i can get the following:
"20090307","19:07:12","xxxx" (8 Replies)
Discussion started by: Pablo_beezo
6. Shell Programming and Scripting
if I have a string delimited by commas how can I put each character on a new line followed by a carriage return, and output this to a filee.g
thanks you (3 Replies)
Discussion started by: Wahmed9
7. Shell Programming and Scripting
I need to write two shell scripts for an rsync backup solution. The first script will copy all backed up files into a folder named after the original folder, plus a date stamp (so e.g. if the original folder name is 'foo' and is backed up on the 10th of September, then the backup folder will be... (0 Replies)
Discussion started by: LambdaCalculus
8. Shell Programming and Scripting
I'm comparing my file date with the system date and if both the dates are equal I'm doing some operation. I use two variables for these two dates. I use the following command in my query. if ....
But here the current date $cd shows 01 and filedate $fdate shows 1. The file is created on 1 of ... (6 Replies)
Discussion started by: pstanand
9. Shell Programming and Scripting
I have a set of files ina diectory which has the name in format "WWW-YYYYmmDD"
like, WWW-20070226. for 26th FEB 2007.
Now I need to write a shell script which should move the files to directory named "old" in the same directory if date attached to file is 90 days prior to today's... (1 Reply)
Discussion started by: jnanesh.b
10. Shell Programming and Scripting
I have the following script (from this forum) to calculate yesterdays date.
However the format of the date that is output is yyyymd if the resultant date is single digit or the resultant month is a single digit month ( 01 - 09 ). How can I get the output to show the date in the following... (3 Replies)
Discussion started by: geomonap
date(1) General Commands Manual date(1)
date - print date and time
date [-c | -u] [ +format ] [[yy[mm[dd]]]hhmm[.ss][-[-]tttt][z]]
If no argument is given, or if the argument begins with +, the current date and time are printed. Otherwise, the current date is set. The
first mm is the month number; dd is the day number in the month; hh is the hour number (24 hour clock); the second mm is the minute number;
.ss the second; -[-]tttt is the minutes west of Greenwich; a positive number means your time zone is west of Greenwich (for example, North
and South America) and a negative number means it is east of Greenwich (for example Europe); z is a one letter code indicating the dst cor-
rection mode (n=none, u=usa, a=australian, w=western europe, m=middle europe, e=eastern europe); yy is the last 2 digits of the year number
and is optional. The following example sets the date to Oct 8, 12:45 AM:
The current year is the default if no year is mentioned. The system operates in GMT. The takes care of the conversion to and from local
standard and daylight time.
If the argument begins with +, the output of is under the control of the user. The format for the output is similar to that of the first
argument to All output fields are of fixed size (zero padded if necessary). Each field descriptor is preceded by % and is replaced in the
output by its corresponding value. A single % is encoded by %%. All other characters are copied to the output without change. The string
is always terminated with a new-line character.
-c Perform operations using Coordinated Universal Time (UCT) instead of the default local time. The UCT does not use leap seconds so
UCT is the same as GMT.
-u Perform operations using Greenwich Mean Time (GMT) instead of the default local time.
The following is a list of field Descriptors that can be used in the format (Note: date exits after processing format information) :
%a Locale's abbreviated weekday name
%A Locale's full weekday name
%b Locale's abbreviated month name
%B Locale's full month name
%c Locale's date and time representation
%d Day of month as a decimal number (01-31)
%D Date (%m/%d/%y)
%h Locale's abbreviated month name
%H Hour as a decimal number (00-23)
%I Hour as a decimal number (01-12)
%j Day of year (001-366)
%m Number of month (01-12)
%M Minute number (00-59)
%n Newline character
%p Locale's equivalent to AM or PM
%r Time in AM/PM notation
%S Second number (00-59)
%t Tab character
%T Time (%H/%M/%S)
%U Week number (00-53), Sunday as first day of week
%w Weekday number (0[Sunday]-6)
%W Week number (00-53), Monday as first day of week
%x Locale's date representation
%X Locale's time representation
%y Year without century (00-99)
%Y Year with century
%Z Timezone name, no characters if no timezone
The following command line
generates the following output
The following command line
date +"DATE: %m/%d/%y%nTIME: %H:%M:%S"
generates the following output
The quotes (") are necessary because the format contains blank characters. Use single quotes (') to prevent interpretation by the shell.
Failed to set date: Not owner
You are not the super-user and you tryed to change the date. Do not change the date while the system is running in multiuser mode.
An attempt to set a date to before 1/1/1970 will result in the date being set to 1/1/1970.