Here is my try for the operation, perhaps a more shorter / better solution can be made ...
Save as program.awk and run as awk -f program.awk input
Year is hardcoded and if variance needs to change, so does zero padding in week variable declaration.
Your input seems the have year on field $5 or $6 which varies on lines, but always on $(NF-1) or a one field before last ?
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)
Dear Expert,
Is there a command to do that in Unix?
In such a way that we don't need to actually "write" or
modified the content.
-- monkfan (4 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 all,
I'm using Red Hat Linux and want to move some folders and files around but not change the modified date. Is this possible?
I know cp has a -p flag which seems to do what I want, but this is a large volume of data so copying and deleting would not be feasible. (13 Replies)
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)
I have a CSV file with a date format like this;
11/19/2012 17:37:00,1.372,121.6
11/19/2012 17:38:00,0.743,121.6
Want to change the time stamp to seconds after 1970 so I can get the data in rrdtool. For anyone interested, this is data from a TED5000 unit and is Kwatts and volts.
Needs to... (3 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)
Discussion started by: invinzin21
5 Replies
LEARN ABOUT DEBIAN
lire::weekcalculator
WeekCalculator(3pm) LogReport's Lire Documentation WeekCalculator(3pm)NAME
Lire::WeekCalculator - handle different weeknumbering schemes
SYNOPSIS
use Lire::WeekCalculator;
my $week_calc = new Lire::WeekCalculator();
my $week_no = $week_calc->week_number( $time );
DESCRIPTION
We support three values for LR_WEEK_NUMBERING: ISO (strftime's %V): week starts on monday; W (week starts on monday) and U (week starts on
sunday). See strftime(1).
CONSTRUCTOR
new( %params )
Creates a new week calculator. The style of week numbering is selected using the "style" parameter. If that parameter is omitted, it
defaults to the style set in 'lr_week_numbering' configuration variable.
style()
Returns the week numbering style used. This will be either "U", "W" or "ISO".
week_number( $time )
Returns the week number of $time according the current week numbering scheme. The week number returned is between 1 and 53.
week_idx( $time )
Returns the week index of $time according to the week numbering scheme. The week index is Lire specific and is used to normalise
computations between different scheme in regards of the first incomplete week of the year. In the ISO case, the week index is always equals
to week_number() - 1, for the other style, the week index of the week 0 will be one less than the last week number of the previous year.
last_week_of_year($year)
Returns the week number of the last week in the year $year.
week_start( $year, $week_no )
Returns the epoch time of the first day of week $week_no in year $year when calculated using current style.
find_year_week1_start_date($year)
Returns the date (epoch) at which the first day of the first week of the year $year starts.
strformat()
Returns a string that can be used as the format specificier in calls to strftime to print the week number of this style.
strfdate()
Emulates POSIX::strftime() but picks up the %V if the system strftime doesn't support it. Should be called whenever you use format strings
that may contain week-of-the-year-codes.
AUTHORS
Joost van Baal <joostvb@logreport.org>,
Francis J. Lacoste <flacoste@logreport.org>,
Wessel Dankers <wsl@logreport.org>
VERSION
$Id: WeekCalculator.pm,v 1.16 2006/07/23 13:16:30 vanbaal Exp $
COPYRIGHT
Copyright (C) 2002 Stichting LogReport Foundation LogReport@LogReport.org
This file is part of Lire.
Lire is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with
http://www.gnu.org/copyleft/gpl.html.
Lire 2.1.1 2006-07-23 WeekCalculator(3pm)