10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all,
How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt
how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies
2. Shell Programming and Scripting
Hello,
I'd like to write a monthly archive script that archives some logs. But I'd like to do it based on yesterday's date. In other words, I'd like to schedule the script to run on the 1st day of each month, but have the archive filename include the previous month instead.
Here's what I... (5 Replies)
Discussion started by: nbsparks
5 Replies
3. Shell Programming and Scripting
Hi
I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this.
Regards
Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies
4. Shell Programming and Scripting
Hello,
I have a file like this:
2012112920121130
12345620121130msABowwiqiq
34477420121129amABamauee
e7748420121130ehABeheheei
in case the content of the file has the date of yesterday within the lines containing pattern AB this should be replaced by the current date. But if I use... (3 Replies)
Discussion started by: Lilu_CK
3 Replies
5. Shell Programming and Scripting
Hi,
I want to compare today's date(DDMMYYYY) with yesterday(DDMMYYYY) from system date,if (today month = yesterday month) then execute alter query else do nothing.
The above requirement i want in Shell script(KSH)...
Can any one please help me?
Double post, continued here. (0 Replies)
Discussion started by: kumarmsk1331
0 Replies
6. Shell Programming and Scripting
Im in EST, and im using the command
CurrentDate=`TZ="EST+24" date +'%y%m%d'`
to get the yesterday's date.
Does this work perfectly for the boundary conditions of month end or year end(leap year) etc ? (2 Replies)
Discussion started by: prasperl
2 Replies
7. Shell Programming and Scripting
HI All,
I am trying so long to find the yesterday's date to run a script but i failed
kinldy share the command to find yesterday's date in ksh
i tried with
date --date='1 day ago'
but it displaying error
your help will highly apeerciated.
Thanks (7 Replies)
Discussion started by: thelakbe
7 Replies
8. Shell Programming and Scripting
hi, i was required to write a shell script to get yesterday's date flatfile. but i only know how to get today's date flatfile. Please observed my below scripting: Please help! Thanks
=================================================
#!/bin/sh
HOST='192.168.1.200'
USER='ftp1'... (19 Replies)
Discussion started by: lifeseries
19 Replies
9. Shell Programming and Scripting
I am currently running the following Korn shell script which works fine:
#!/usr/bin/ksh
count=`db2 -x "select count(*) from schema.tablename"`
echo "count"
I would like to add a "where" clause to the 2nd line that would allow me to get a record count of all the records from schema.tablename... (9 Replies)
Discussion started by: sasaliasim
9 Replies
10. Shell Programming and Scripting
Hi expert,
I want to retrieve yesterday su log.
How to calculate and assign variable value ( 06/23 ) in myVariable ?
#!/bin/sh
myVariable=yesterday date in month/date
cat /var/adm/sulog | grep $myVariable > file.txt
many thanks! (5 Replies)
Discussion started by: skully
5 Replies
Template::Plugin::Date(3) User Contributed Perl Documentation Template::Plugin::Date(3)
NAME
Template::Plugin::Date - Plugin to generate formatted date strings
SYNOPSIS
[% USE date %]
# use current time and default format
[% date.format %]
# specify time as seconds since epoch
# or as a 'h:m:s d-m-y' or 'y-m-d h:m:s' string
[% date.format(960973980) %]
[% date.format('4:20:36 21/12/2000') %]
[% date.format('2000/12/21 4:20:36') %]
# specify format
[% date.format(mytime, '%H:%M:%S') %]
# specify locale
[% date.format(date.now, '%a %d %b %y', 'en_GB') %]
# named parameters
[% date.format(mytime, format = '%H:%M:%S') %]
[% date.format(locale = 'en_GB') %]
[% date.format(time = date.now,
format = '%H:%M:%S',
locale = 'en_GB) %]
# specify default format to plugin
[% USE date(format = '%H:%M:%S', locale = 'de_DE') %]
[% date.format %]
...
DESCRIPTION
The "Date" plugin provides an easy way to generate formatted time and date strings by delegating to the "POSIX" "strftime()" routine.
The plugin can be loaded via the familiar USE directive.
[% USE date %]
This creates a plugin object with the default name of '"date"'. An alternate name can be specified as such:
[% USE myname = date %]
The plugin provides the "format()" method which accepts a time value, a format string and a locale name. All of these parameters are
optional with the current system time, default format ('"%H:%M:%S %d-%b-%Y"') and current locale being used respectively, if undefined.
Default values for the time, format and/or locale may be specified as named parameters in the "USE" directive.
[% USE date(format = '%a %d-%b-%Y', locale = 'fr_FR') %]
When called without any parameters, the "format()" method returns a string representing the current system time, formatted by "strftime()"
according to the default format and for the default locale (which may not be the current one, if locale is set in the "USE" directive).
[% date.format %]
The plugin allows a time/date to be specified as seconds since the epoch, as is returned by "time()".
File last modified: [% date.format(filemod_time) %]
The time/date can also be specified as a string of the form "h:m:s d/m/y" or "y/m/d h:m:s". Any of the characters : / - or space may be
used to delimit fields.
[% USE day = date(format => '%A', locale => 'en_GB') %]
[% day.format('4:20:00 9-13-2000') %]
Output:
Tuesday
A format string can also be passed to the "format()" method, and a locale specification may follow that.
[% date.format(filemod, '%d-%b-%Y') %]
[% date.format(filemod, '%d-%b-%Y', 'en_GB') %]
A fourth parameter allows you to force output in GMT, in the case of seconds-since-the-epoch input:
[% date.format(filemod, '%d-%b-%Y', 'en_GB', 1) %]
Note that in this case, if the local time is not GMT, then also specifying '%Z' (time zone) in the format parameter will lead to an
extremely misleading result.
Any or all of these parameters may be named. Positional parameters should always be in the order "($time, $format, $locale)".
[% date.format(format => '%H:%M:%S') %]
[% date.format(time => filemod, format => '%H:%M:%S') %]
[% date.format(mytime, format => '%H:%M:%S') %]
[% date.format(mytime, format => '%H:%M:%S', locale => 'fr_FR') %]
[% date.format(mytime, format => '%H:%M:%S', gmt => 1) %]
...etc...
The "now()" method returns the current system time in seconds since the epoch.
[% date.format(date.now, '%A') %]
The "calc()" method can be used to create an interface to the "Date::Calc" module (if installed on your system).
[% calc = date.calc %]
[% calc.Monday_of_Week(22, 2001).join('/') %]
The "manip()" method can be used to create an interface to the "Date::Manip" module (if installed on your system).
[% manip = date.manip %]
[% manip.UnixDate("Noon Yesterday","%Y %b %d %H:%M") %]
AUTHORS
Thierry-Michel Barral wrote the original plugin.
Andy Wardley provided some minor fixups/enhancements, a test script and documentation.
Mark D. Mills cloned "Date::Manip" from the "Date::Calc" sub-plugin.
COPYRIGHT
Copyright (C) 2000-2007 Thierry-Michel Barral, Andy Wardley.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template::Plugin, POSIX
perl v5.12.1 2009-06-30 Template::Plugin::Date(3)