Sponsored Content
Full Discussion: Date Query
Top Forums UNIX for Dummies Questions & Answers Date Query Post 302488463 by theref on Monday 17th of January 2011 08:55:56 AM
Old 01-17-2011
Thanks for the swift reply but I really need this to be included in a ksh script that will run from the crontab as I need to use the dates as variables when it comes to generating the reports.

Any advice on how to do this would be great - thanks!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unix Date query

Hi there, I am trying to do the following in Unix (Solaris 2.7): 1...Find the actual date 7 days ago in format (dd-mmm-yyyy) and with the weekday prefably, 2...Find the date 5 days after the above in the same format. How can I do this in Unix instead of accessing our Oracle database and... (5 Replies)
Discussion started by: csong2
5 Replies

2. UNIX for Dummies Questions & Answers

Date change related query

Good day folks, This is my first post on this board and I thank you in advance for helping me with this issue. Any idea how I can synchronize server time with another timeserver but have my server lag behind by 2 seconds? Meaning...I need a simple unix script that I can run as crone that... (2 Replies)
Discussion started by: franklo
2 Replies

3. Shell Programming and Scripting

Date & NUmber Validation Query

Hi Do you have any pointers how to validate numbers (not to contain alphabets and special characters) and date(MM/DD/YYYY) format. I used following regular expression to validate integer, which is not working in the default shell: nodigits="$(echo $testvalue | sed 's/]//g')" ... (4 Replies)
Discussion started by: alok_jax
4 Replies

4. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

5. Shell Programming and Scripting

Query regarding date field in shell script

Hi, I wrote a simple shell script which accepts the input value yearmonth in the format YYYYMM and displays the date as YYYY-MM-DD.Day will be 01 always.Please find the code below #!/bin/ksh export yearmonth_date=$1 print_usage() { echo "usage: ${0##*/} <yearmonth_date> \n" \ ... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

6. Shell Programming and Scripting

Convertion of Date Format using SQL query in a shell script

When I write Select date_field from TableA fetch first row only I am getting the output as 09/25/2009. I want to get the output in the below format 2009-09-25 i.e., MM-DD-YYYY. Please help (7 Replies)
Discussion started by: dinesh1985
7 Replies

7. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

8. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

9. Shell Programming and Scripting

Converting a date to friday date and finding Min/Max date

Dear all, I have 2 questions. I have a file with many rows which has date of the format YYYYMMDD. 1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too. 2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 Replies

10. Shell Programming and Scripting

Query - date command

Hi, I am trying to capture the total run time of a script which contains SQL's by providing date command in top & bottom, it displaying both the times same in top & bottom.However the time in the sql connection is different.Please help. OS - LINUX Shell - ksh printf "Script Started at... (3 Replies)
Discussion started by: nag_sathi
3 Replies
Cache::Entry(3pm)					User Contributed Perl Documentation					 Cache::Entry(3pm)

NAME
Cache::Entry - interface for a cache entry SYNOPSIS
my Cache::Entry $entry = $cache->entry( $key ) my $data; if ($entry->exists()) { $data = $entry->get(); } else { $data = get_some_data($key); $entry->set($data, '10 minutes'); } DESCRIPTION
Objects derived from Cache::Entry represent an entry in a Cache. Methods are provided that act upon the data in the entry, and allow you to set things like the expiry time. Users should not create instances of Cache::Entry directly, but instead use the entry($key) method of a Cache instance. METHODS
my $cache = $e->cache() Returns a reference to the cache object this entry is from. my $key = $e->key() Returns the cache key this entry is associated with. my $bool = $e->exists() Returns a boolean value (1 or 0) to indicate whether there is any data present in the cache for this entry. $e->set( $data, [ $expiry ] ) Stores the data into the cache. The data must be a scalar (if you want to store more complex data types, see freeze and thaw below). The expiry time may be provided as an optional 2nd argument and is in the same form as for 'set_expiry($time)'. my $data = $e->get() Returns the data from the cache, or undef if the entry doesn't exist. my $size = $e->size() Returns the size of the entry data, or undef if the entry doesn't exist. $e->remove() Clear the data for this entry from the cache. my $expiry = $e->expiry() Returns the expiry time of the entry, in seconds since the epoch. $e->set_expiry( $time ) Set the expiry time in seconds since the epoch, or alternatively using a string like '10 minutes'. Valid units are s, second, seconds, sec, m, minute, minutes, min, h, hour, hours, w, week, weeks, M, month, months, y, year and years. You can also specify an absolute time, such as '16 Nov 94 22:28:20' or any other time that Date::Parse can understand. Finally, the strings 'now' and 'never' may also be used. my $fh = $e->handle( [$mode, [$expiry] ] ) Returns an IO::Handle by which data can be read, or written, to the cache. This is useful if you are caching a large amount of data - although it should be noted that only some cache implementations (such as Cache::File) provide an efficient mechanism for implementing this. The optional mode argument can be any of the perl mode strings as used for the open function '<', '+<', '>', '+>', '>>' and '+>>'. Alternatively it can be the corresponding fopen(3) modes of 'r', 'r+', 'w', 'w+', 'a' and 'a+'. The default mode is '+<' (or 'r+') indicating reading and writing. The second argument is used to set the expiry time for the entry if it doesn't exist already and the handle is opened for writing. It is also used to reset the expiry time if the entry is truncated by opening in the '>' or '+>' modes. If the expiry is not provided in these situations then the default expiry time for the cache is applied. Cache implementations will typically provide locking around cache entries, so that writers will have have an exclusive lock and readers a shared one. Thus the method get() (or obtaining another handle) should be avoided whilst a write handle is held. Using set() or remove(), however, should be supported. These clear the current entry and whilst they do not invalidate open handles, those handle will from then on refer to old data and any changes to the data will be discarded. STORING VALIDITY OBJECTS
There are two additional set & get methods that can be used to store a validity object that is associated with the data in question. Typically this is useful in conjunction with a validate_callback, and may be used to store a timestamp or similar to validate against. The validity data stored may be any complex data that can be serialized via Storable. $e->validity() $e->set_validity( $data ) STORING COMPLEX OBJECTS
The set and get methods only allow for working with simple scalar types, but if you want to store more complex types they need to be serialized first. To assist with this, the freeze and thaw methods are provided. They are simple wrappers to get & set that use Storable to do the serialization and de-serialization of the data. Note, however, that you must be careful to ONLY use 'thaw' on data that was stored via 'freeze'. Otherwise the stored data wont actually be in Storable format and it will complain loudly. $e->freeze( $data, [ $expiry ] ) Identical to 'set', except that data may be any complex data type that can be serialized via Storable. $e->thaw() Identical to 'get', except that it will return a complex data type that was set via 'freeze'. SEE ALSO
Cache, Cache::File AUTHOR
Chris Leishman <chris@leishman.org> Based on work by DeWitt Clinton <dewitt@unto.net> COPYRIGHT
Copyright (C) 2003-2006 Chris Leishman. All Rights Reserved. This module is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. This program is free software; you can redistribute or modify it under the same terms as Perl itself. $Id: Entry.pm,v 1.8 2006/01/31 15:23:58 caleishm Exp $ perl v5.12.4 2011-08-05 Cache::Entry(3pm)
All times are GMT -4. The time now is 08:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy