10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
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
2. Shell Programming and Scripting
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)
Discussion started by: Rahul Raj
3 Replies
3. Shell Programming and Scripting
Hi ,
How can I add/substruct x number of days with date?
For example
My_Date=`date`
Now I need
Hope it's clear. (2 Replies)
Discussion started by: Anupam_Halder
2 Replies
4. Shell Programming and Scripting
I have requirment to get last date of previous month and the first date of previous 4th month:
Example:
Current date: 20130320 (yyyymmdd)
Last date of previous month: 20130228 (yyyymmdd)
First date of previous 4th month: 20121101 (yyyymmdd)
In my shell --date, -d, -v switches are not... (3 Replies)
Discussion started by: machomaddy
3 Replies
5. Shell Programming and Scripting
I got a statement like below to subtract 1 from given date using teradata. I am looking for a one line unix command to perform the same.
select 'parse_this_record', (DATE '${FILE_DATE}' - 1) (FORMAT 'YYYY-MM-DD');
Input: 2012-02-21
Expected Output: 2012-02-20
PS: One liner because I am... (2 Replies)
Discussion started by: siteregsam
2 Replies
6. UNIX for Dummies Questions & Answers
Hi folks
month=`date +%m`gives current month
Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies
7. UNIX for Dummies Questions & Answers
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)
Discussion started by: St.Fartatric
1 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I'm a newbie to unix and i'm loving every bit of it.
I need assistance in setting my date function in my script to "new month".
What I want to do is define the "newmonth" as the 1st of every month so my script can run by this time evry month through the year.
Can someone assist.
... (1 Reply)
Discussion started by: Agent704
1 Replies
9. Shell Programming and Scripting
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)
Discussion started by: roadcyclist
0 Replies
10. Shell Programming and Scripting
Hello
I want to get end date of the any month in unix . is there any function to do this.
we can get month from date command 'date +%b'
example:
If Feb month then last date is 28
if sep then last date 30. like this
thanks
please help (12 Replies)
Discussion started by: rajan_ka1
12 Replies
CAL(1) BSD General Commands Manual CAL(1)
NAME
cal, ncal -- displays a calendar and the date of Easter
SYNOPSIS
cal [-3hjy] [-A number] [-B number] [[month] year]
cal [-3hj] [-A number] [-B number] -m month [year]
ncal [-3hjJpwy] [-A number] [-B number] [-s country_code] [[month] year]
ncal [-3hJeo] [-A number] [-B number] [year]
ncal [-CN] [-H yyyy-mm-dd] [-d yyyy-mm]
DESCRIPTION
The cal utility displays a simple calendar in traditional format and ncal offers an alternative layout, more options and the date of Easter.
The new format is a little cramped but it makes a year fit on a 25x80 terminal. If arguments are not specified, the current month is dis-
played.
The options are as follows:
-h Turns off highlighting of today.
-J Display Julian Calendar, if combined with the -e option, display date of Easter according to the Julian Calendar.
-e Display date of Easter (for western churches).
-j Display Julian days (days one-based, numbered from January 1).
-m month
Display the specified month. If month is specified as a decimal number, it may be followed by the letter 'f' or 'p' to indicate the
following or preceding month of that number, respectively.
-o Display date of Orthodox Easter (Greek and Russian Orthodox Churches).
-p Print the country codes and switching days from Julian to Gregorian Calendar as they are assumed by ncal. The country code as deter-
mined from the local environment is marked with an asterisk.
-s country_code
Assume the switch from Julian to Gregorian Calendar at the date associated with the country_code. If not specified, ncal tries to
guess the switch date from the local environment or falls back to September 2, 1752. This was when Great Britain and her colonies
switched to the Gregorian Calendar.
-w Print the number of the week below each week column.
-y Display a calendar for the specified year.
-3 Display the previous, current and next month surrounding today.
-A number
Display the number of months after the current month.
-B number
Display the number of months before the current month.
-C Switch to cal mode.
-N Switch to ncal mode.
-d yyyy-mm
Use yyyy-mm as the current date (for debugging of date selection).
-H yyyy-mm-dd
Use yyyy-mm-dd as the current date (for debugging of highlighting).
A single parameter specifies the year (1-9999) to be displayed; note the year must be fully specified: ``cal 89'' will not display a calendar
for 1989. Two parameters denote the month and year; the month is either a number between 1 and 12, or a full or abbreviated name as speci-
fied by the current locale. Month and year default to those of the current system clock and time zone (so ``cal -m 8'' will display a calen-
dar for the month of August in the current year).
Not all options can be used together. For example ``-3 -A 2 -B 3 -y -m 7'' would mean: show me the three months around the seventh month,
three before that, two after that and the whole year. ncal will warn about these combinations.
A year starts on January 1.
Highlighting of dates is disabled if stdout is not a tty.
SEE ALSO
calendar(3), strftime(3)
HISTORY
A cal command appeared in Version 5 AT&T UNIX. The ncal command appeared in FreeBSD 2.2.6.
AUTHORS
The ncal command and manual were written by Wolfgang Helbig <helbig@FreeBSD.org>.
BUGS
The assignment of Julian-Gregorian switching dates to country codes is historically naive for many countries.
Not all options are compatible and using them in different orders will give varying results.
BSD
March 14, 2009 BSD