Sponsored Content
Full Discussion: General Purpose Date Script
Top Forums UNIX for Beginners Questions & Answers General Purpose Date Script Post 302868037 by targzeta on Friday 25th of October 2013 05:09:55 PM
Old 10-25-2013
Ok, I'm using Linux Slackware64 but...
Code:
perl date.pl 
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /usr/local/lib64/perl5
 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at date.pl line 3.
BEGIN failed--compilation aborted at date.pl line 3.

it seems that Switch it's no so standard Smilie.

Is it a bug?
Code:
# 1)
$> date --date="2013/10/20 - 203 days" '+%Y-%m-%d %H-%M-%S'
2013-03-31 00-00-00

$> perl date.pl -d '2013/10/20 - 203 days'
2013-03-30 23:00:00

# 2)
$> date --date="2013/10/25 + 3 days" '+%Y-%m-%d %H-%M-%S'
2013-10-28 00-00-00

$> perl date.pl -d '2013/10/25 + 3 days'
2013-10-27 23:00:00

# 3)
$> perl date.pl -d 'now + 3 days'
Unknown argument now

$> perl date.pl -d 'today + 3 days'
Unknown argument today

I think it's very hard what you're trying to do.

Emanuele
This User Gave Thanks to targzeta For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Looking for a general purpose System Monitor

Does anyone have any scripts or suggestions on a general purpose Unix/Linux monitoring tool? (5 Replies)
Discussion started by: darthur
5 Replies

2. UNIX for Dummies Questions & Answers

whats the purpose of the following script?

whats the purpose of the following script? who could run it? To what is the script refering that exceeds 75%? The mailbox? What does sed 's/%//' do? (1 Reply)
Discussion started by: vrn
1 Replies

3. Shell Programming and Scripting

General Q: how to run/schedule a php script from cron jobs maybe via bash from shell?

Status quo is, within a web application, which is coded completely in php (not by me, I dont know php), I have to fill out several fields, and execute it manually by clicking the "go" button in my browser, several times a day. Thats because: The script itself pulls data (textfiles) from a... (3 Replies)
Discussion started by: lowmaster
3 Replies

4. Shell Programming and Scripting

awk (?) help or just general script

I have two files (___ represents blanks) Foo1 1000 345 456 1001 876 908 1002 ___ 786 1003 643 908 1004 345 234 and Foo2 1000 345 1001 876 1002 111 1003 643 1004 345 (3 Replies)
Discussion started by: garethsays
3 Replies

5. Shell Programming and Scripting

script to fill up disk space for testing purpose

Hello everyone I am new to this forum I am working on a project and needed a test script to fill up a disk partition /tmp/data to see how the program fails. The system I am working on is a redhat 5.3. Is there anything out there? Thanks. (10 Replies)
Discussion started by: dp100022
10 Replies

6. UNIX for Dummies Questions & Answers

Purpose of - (hypen) in script or command line

Hi, I am new for unix and I am following ABS guide. What is the purpose of - (hypen ) in the below command and What it will do in this?. Can anyone explain it in detail. Rest of the things in the below command I understood somewhat. (cd /source/directory && tar cf - . ) | (cd /dest/directory &&... (1 Reply)
Discussion started by: gwgreen1
1 Replies

7. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

8. UNIX for Beginners Questions & Answers

General Purpose XML Processing

I've been kicking this around for a while now, I might as well post it here. v0.0.9, now properly supporting self-closing tags. v0.0.8, an important quoting fix and a minor change which should handle special <? <!-- etc. tags without seizing up as often. Otherwise the code hasn't changed much.... (6 Replies)
Discussion started by: Corona688
6 Replies
Date::Manip::Obj(3)					User Contributed Perl Documentation				       Date::Manip::Obj(3)

NAME
Date::Manip::Obj - Base class for Date::Manip objects SYNOPSIS
The Date::Manip::Obj class is the base class used for the following Date::Manip classes: Date::Manip::Base Date::Manip::TZ Date::Manip::Date Date::Manip::Delta Date::Manip::Recur This module is not intended to be called directly and performs no useful function by itself. Instead, use the various derived classes which inherit from it. DESCRIPTION
This module contains a set of methods used by all Date::Manip classes listed above. You should be familiar with the Date::Manip::Objects and Date::Manip::Config documentation. In the examples below, Date::Manip::Date objects will be used as examples, but (unless otherwise stated), all of the classes listed above have the same methods, and work in the same fashion. METHODS FOR CREATING OBJECTS
new $date = new Date::Manip::Date; $date = new Date::Manip::Date @opts; $date = new Date::Manip::Date $string; $date = new Date::Manip::Date $string,@opts; In order to create the first Date::Manip object, use any of the forms listed above. They will all create a new Date::Manip::Date object (with new Date::Manip::Base, and Date::Manip::TZ objects embedded in it). The Date::Manip::Date, Date::Manip::Delta, and Date::Manip::Recur classes work in exactly the same way. A set of options (described in the Date::Manip::Config documentation) can be passed to the object to set configuration variables. In addition, a string can be passed in which will be parsed to form the initial date stored in the object. Strings can also be passed in to the Date::Manip::Delta and Date::Manip::Recur objects which will be parsed to form initial values. In all cases, refer to the parse method of the class. $dmt = new Date::Manip::TZ; $dmt = new Date::Manip::TZ @opts; If the first Date::Manip object you need is a Date::Manip::TZ object, use either of the above calls. This will also create a Date::Manip::Base object which will be embedded in the Date::Manip::TZ object. A set of options can be passed in as well, but there is no option for passing in a string. $dmb = new Date::Manip::Base; $dmb = new Date::Manip::Base @opts; If you work with Date::Manip::Base objects directly, no other object will be created. The options can be passed in here as well. Once a Date::Manip::Date object (or any object in any other Date::Manip class) is created, one of calls below should be used in order to preserve cached data in the interest of performance and memory usage. $date = new Date::Manip::Date $obj; $date = new Date::Manip::Date $obj,@opts; $date = new Date::Manip::Date $obj,$string; $date = new Date::Manip::Date $obj,$string,@opts; $obj can be an object from any of the Date::Manip classes, but in the interest of making efficient use of cached data, you should pass in the highest level object available. In other words, you should always pass in a Date::Manip::Date, Date::Manip::Delta, or Date::Manip::Recur object if you have one. In their absence, pass in a Date::Manip::TZ object. Pass in a Date::Manip::Base object only if that is the only Date::Manip object available. The one caveat is if you are working with multiple configurations as described in the Date::Manip::Objects document. In that case, additional care should be taken to make sure that the correct object is passed in. If $obj is a Date::Manip::Date object, these lines can be expressed equivalently as: $date = $obj->new(); $date = $obj->new(@opts); $date = $obj->new($string); $date = $obj->new($string,@opts); If @opts is passed in, new Date::Manip::Base and Date::Manip::TZ objects will be created with the configuration specified, so you should only do this if you explicitly want to work with multiple configurations. If you want to modify an existing configuration, you must use the config method described below. new_config $obj2 = $obj1->new_config(); $obj2 = $obj1->new_config($string); $obj2 = $obj1->new_config($string,@opts); $obj2 = $obj1->new_config(@opts); This creates a new instance with a new Date::Manip::Base object and a separate set of config options (even if no config options are included). new_date new_delta new_recur $date = $obj->new_date(); $date = $obj->new_date($string); $date = $obj->new_date($string,@opts); $date = $obj->new_date(@opts); These create a new instance of the specified object. In this case, $obj can be any of the Date::Manip classes, so a date can be created from a delta: $delta = new Date::Manip::Delta; $date = $delta->new_date(); OTHER METHODS
base $dmb = $obj->base(); This returns the Date::Manip::Base object associated with the given object. config $obj->config($var1,$val1,$var2,$val2,...); This will set the value of any configuration variables. Please refer to the Date::Manip::Config manual for a list of all configuration variables and their description. err $err = $obj->err(); This will return the full error message if the previous operation failed for any reason. $obj->err(1); will clear the error code. is_date is_delta is_recur $flag = $obj->is_date(); Returns 0 or 1, depending on the object. For example, a Date::Manip::Date object returns 1 with the is_date method, and 0 for the other two. tz $dmb = $obj->tz(); This returns the Date::Manip::TZ object associated with the given object. version $vers = $obj->version($flag); This returns the version of Date::Manip. If $flag is passed in, and $obj is not a Date::Manip::Base object, the version and timezone information will be passed back. KNOWN BUGS
None known. BUGS AND QUESTIONS
Please refer to the Date::Manip::Problems documentation for information on submitting bug reports or questions to the author. SEE ALSO
Date::Manip - main module documentation LICENSE
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Sullivan Beck (sbeck@cpan.org) perl v5.12.1 2010-01-12 Date::Manip::Obj(3)
All times are GMT -4. The time now is 12:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy