Hi i am trying to subtract days from current date. For example todays date is 10/03/2006. If i subtract 2 days it should give 8/03/2006. I am also trying to find the access date of a file in dd/mm/yyyy format. Can any one please help in how to do this.
Ramesh (1 Reply)
I have looked through the forums and found many date / time manipulation tools, but cannot seem to find something that fits my needs for the following.
I have a log file with date time stamps like this:
Jun 21 17:21:52
Jun 21 17:24:56
Jun 21 17:27:59
Jun 21 17:31:03
Jun 21 17:34:07
Jun... (0 Replies)
how can we add or subtract days from the output of date command in unix...
like if i want to subtract a day from the result of date command like this..
v_date=`date +%Y%m%d`
this wud give me 20080519
now i want to subtract one day from this.. so tht it wud give me 20080518..
how do i do... (1 Reply)
Hi Gurus!
I have a static date in a YYYYMMDD format; and I want get the date 2 years in the past and 2 years in the future.
static_date=20010203
old_date=$static_date - 3 years
future_date=$static_date + 2 years
I was only able to research on dates that are current and not on static... (3 Replies)
Hi,
Is there a way to subtract a month or at least 30 days from an arbitrary or user inputted date without the GNU date?
Example:
please Input date: 2011-05-11
then the answer will be 2011-04-11
This code doesn't work:
$date -d "2011-05-11 - 1 month" "+%Y%m%d"
Thanks (7 Replies)
Hi All,
I am getting a date from environment variable and want to do some processing by subtracting 2 months from the date passed through the environment variable.
I am trying the following syntax :
date_var=2014-08-31
date_2M_ago='$date_var+"%d%m%y" --$date_var="2 months ago" '... (3 Replies)
I am trying to achieve to get only the month and the day. Example Feb 5 (as you can see if it is feb 1-9) the space is 2. If it is feb 10-28, the space is only 1. I am trying to right a script that will list a directory and shoot an email if there is an activity in last 7 days. I dont really trust... (5 Replies)
Hi All,
I have a CSV file which is as below. Basically I need to take the year column in it and find if the year is >= 20152 . If that is then I should subtract all values by 6. In the below example in description I am having number mentioned as YYWW so I need to subtract those by -5. Whereever... (8 Replies)
Discussion started by: arunkumar_mca
8 Replies
LEARN ABOUT OPENSOLARIS
builtin
builtin(1) User Commands builtin(1)NAME
builtin - ksh93 built-in function to add, delete, or display shell built-ins
SYNOPSIS
builtin [-ds] [-f lib] [pathname ...]
DESCRIPTION
The ksh93 builtin command adds, deletes, or displays built-in commands in the current shell environment. A built-in command executes in the
current shell process and can have side effects in the current shell. On most systems, the invocation time for built-in commands is one or
two orders of magnitude less than commands that create a separate process.
For each pathname specified, the basename of the pathname determines the name of the built-in. For each basename, the shell looks for a C
level function in the current shell whose name is determined by pre-pending b_ to the built-in name. If pathname contains a forward slash
(/), the built-in is bound to pathname. A built-in bound to a pathname is only executed if pathname is the first executable found during a
path search. Otherwise, built-ins are found prior to performing the path search.
If pathname is not specified, builtin displays the current list of built-ins, or just the special built-ins if the -s option is specified,
on standard output. The full pathname for built-ins that are bound to pathnames are displayed.
Libraries containing built-ins can be specified with the -f option. If the library contains a function named lib_init(), this function is
invoked with argument 0 when the library is loaded. The lib_init() function can load built-ins by invoking an appropriate C level function.
In this case there is no restriction on the C level function name.
The C level function is invoked with three arguments. The first two are the same as main() and the third one is a pointer.
The ksh93 builtin command cannot be invoked from a restricted shell.
OPTIONS
The following options are supported:
-d Delete each of the specified built-ins. Special built-ins cannot be deleted.
-f lib On systems with dynamic linking, load and search for built-ins in the shared library, lib.
Libraries are searched for in $PATH and system dependent library directories. The system dependent shared library prefix or suf-
fix can be omitted. Once a library is loaded, its symbols become available for the current and subsequent invocations of builtin.
Multiple libraries can be specified with separate invocations of builtin. Libraries are searched in the reverse order in which
they are specified.
-s Display only the special built-ins.
OPERANDS
The following operands are supported:
pathname Specifies the pathname. The basename of the pathname determines the name of the built-in.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
EXAMPLES
Example 1 Loading a builtin Command
The following example loads a builtin command mycmd from the library libfoo.so:
example% builtin -f foo mycmd
AUTHORS
David Korn, dgk@research.att.com
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
|Interface Stability |Uncommitted |
+-----------------------------+-----------------------------+
SEE ALSO ksh93(1), whence(1), attributes(5)SunOS 5.11 1 May 2007 builtin(1)