Sponsored Content
Full Discussion: Date Range Problem
Top Forums Shell Programming and Scripting Date Range Problem Post 302426132 by nitin14341 on Tuesday 1st of June 2010 01:27:47 AM
Old 06-01-2010
Date Range Problem

Hi All,

I have a log file which has first few characters of every line as a timestamp.

Code:
2010-06-01 04:56:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 04:56:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 04:56:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 04:56:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 05:22:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 05:22:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 05:22:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 05:22:02,802 DEBUG {Thread-27}  Some text message
2010-06-01 06:43:02,802 INFO  {Thread-27}  Some text message
2010-06-01 06:43:02,803 INFO  {Thread-27}  Some text message
2010-06-01 06:43:02,804 INFO  {Thread-27}  Some text message
2010-06-01 06:43:02,804 INFO  {Thread-27}  Some text message
2010-06-01 06:43:02,809 DEBUG {Thread-27}  Some text message
2010-06-01 06:43:02,809 DEBUG {Thread-27}  Some text message
2010-06-01 06:43:02,809 DEBUG {Thread-27}  Some text message
2010-06-01 07:08:02,809 DEBUG {Thread-27}  Some text message
2010-06-01 07:08:02,809 DEBUG {Thread-27}  Some text message

My aim to find all such lines which have the timestamp of 1 hr before the current time.

How can this be achieved?

TIA,
Nitin.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cp only files in certain date range

hi all, I'm trying to do a cp only on files I created on a given day or within a certain date range. What's the best way to do this? Cheers, KL (1 Reply)
Discussion started by: ee7klt
1 Replies

2. Shell Programming and Scripting

Get date range between 2 date input

Hi Experts, I have files name report_20090416 report_20090417 report_20090418 report_20090420 report_20090421 I have 2 input from user From Date: 20090417 To Date: 20090420 and I need to grep only those line in between. Output should be report_20090417 report_20090418... (3 Replies)
Discussion started by: tanit
3 Replies

3. Shell Programming and Scripting

Date Range problem

Hi , I need a function that verfies the given date is between start date and end date . I have written this but this not working if start date is 1900/01/01 Below is my code validateDate() { RC=$# if then return 0 else ... (2 Replies)
Discussion started by: Satyak
2 Replies

4. UNIX Desktop Questions & Answers

date range

I have a number of instances wher I need to run reports for the previous month and need to include the last months date range in the sql. I want to create a string which consists of the first and last dates of last month separated with an ' and ' ie for this month (Feb) I want it to say '01/01/10... (3 Replies)
Discussion started by: Niven
3 Replies

5. Shell Programming and Scripting

Script on Date Range

Hi All, Can anybody help me out a Shell script which pulls the files based on date range Example ./test.sh start_date End_date (20110901 20110930) or ./test.sh ( if we don't provide any input) it should take sysdate-1 ( yesterdays date) it should have both conditions Plzz help me... (1 Reply)
Discussion started by: krux_rap
1 Replies

6. Shell Programming and Scripting

Date Range in UNIX

Hi Everyone How all are doing today, Want some help from All in Unix, What I am trying to do is , A shell file should be a called with two date parameters suppose the shell file name is run.sh run.sh <start_date> <end_date> If end date is not given it will pick today's date. The date should... (7 Replies)
Discussion started by: adisky123
7 Replies

7. Shell Programming and Scripting

Date listing in a date range

Solaris 10 ksh88 Sorry for re-hashing some of this, but I can't find a proper solution in the forums. Starting with /a/archive containing (on and on date formatted directories) 20060313 20080518 20100725 20121015 20060314 20080519 ... (1 Reply)
Discussion started by: moesplace
1 Replies

8. UNIX for Dummies Questions & Answers

How can i get the date range for the last 4 days?

Hi i am try to run a script by using a dates here is what i am doing EXPORTDATE=`date --date "2 days ago" +%Y-%m-%d` sh /path/to/the/files.sh ${EXPORTDATE} the above code runs the job for one day,if i want to run the job for all the past 4 days how can i pass the date as a... (1 Reply)
Discussion started by: vikatakavi
1 Replies

9. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

10. Shell Programming and Scripting

Date range

Dear all, how can I select in the file below only the files created between Aug 14 2014 and Feb 03 2015? EZA2284I -rw-r--r-- 1 30 8 356954 Aug 15 2014 file1 EZA2284I -rw-rw-r-- 1 30 8 251396 Feb 05 12:53 file2 EZA2284I -rw-rw-r-- 1 30 8 ... (3 Replies)
Discussion started by: simomuc
3 Replies
Thread(3pm)						User Contributed Perl Documentation					       Thread(3pm)

NAME
Mail::Thread - Perl implementation of JWZ's mail threading algorithm SYNOPSIS
use Mail::Thread; my $threader = new Mail::Thread (@messages); $threader->thread; dump_em($_,0) for $threader->rootset; sub dump_em { my ($self, $level) = @_; print ' \-> ' x $level; if ($self->message) { print $self->message->head->get("Subject") , " "; } else { print "[ Message $self not available ] "; } dump_em($self->child, $level+1) if $self->child; dump_em($self->next, $level) if $self->next; } DESCRIPTION
This module implements something relatively close to Jamie Zawinski's mail threading algorithm, as described by http://www.jwz.org/doc/threading.html. Any deviations from the algorithm are accidental. It's happy to be handed any mail object supported by "Email::Abstract". If you need to do anything else, you'll have to subclass and override "_get_hdr". METHODS
new(@messages) Creates a new threader; requires a bunch of messages to thread. thread Goes away and threads the messages together. rootset Returns a list of "Mail::Thread::Container"s which are not the parents of any other message. order($ordering_sub) calls "order_children" over each member of the root set, from one level higher "Mail::Thread::Container" methods "Mail::Thread::Container"s are the nodes of the thread tree. You can't just have the ordinary messages, because we might not have the message in question. For instance, a mailbox could contain two replies to a question that we haven't received yet. So all "logical" messages are stuffed in containers, whether we happen to have that container or not. To do anything useful with the thread tree, you're going to have to recurse around the list of "Mail::Thread::Containers". You do this with the following methods: parent child next Returns the container which is the parent, child or immediate sibling of this one, if one exists. message Returns the message held in this container, if we have one. messageid Returns the message ID for this container. This will be around whether we have the message or not, since some other message will have referred to it by message ID. header( $name ) returns the named header of the contained message subject returns the subject line of the contained message isreply examines the results of ->subject and returns true if it looks like a reply simple_subject the simplified version of ->subject (with reply markers removed) has_descendent($child) Returns true if this container has the given container as a child somewhere beneath it. add_child($child) Add the $child as a child of oneself. remove_child($child) Remove the $child as a child from oneself. children Returns a list of the immediate children of this container. set_children(@children) set the children of a node. does not update the ->parents of the @children order_children($ordering_sub) Recursively reorders children according to the results of $ordering_sub $ordering_sub is called with the containers children, and is expected to return them in their new order. # order by subject line $container->order_children( sub { sort { $a->topmost->message->subject cmp $b->topmost->message->subject } @_ } ); $ordering_sub may be omitted, in which case no ordering takes place topmost Walks the tree depth-first and returns the first message container found with a message attached recurse_down($callback) Calls the given callback on this node and all of its children. DEBUGGING
You can set $Mail::Thread::debug=1 to watch what's going on. MAINTAINER
Tony Bowden BUGS and QUERIES Please direct all correspondence regarding this module to: bug-Mail-Thread@rt.cpan.org ORIGINAL AUTHOR
Simon Cozens, <simon@cpan.org> COPYRIGHT AND LICENSE
Copyright 2003 by Kasei Copyright 2004 by Simon Cozens This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2006-10-30 Thread(3pm)
All times are GMT -4. The time now is 09:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy