Sponsored Content
Top Forums Shell Programming and Scripting Getting previous hour in formatted form Post 302510995 by ctsgnb on Tuesday 5th of April 2011 12:50:46 PM
Old 04-05-2011
My understanding is 6 stand for 6 hours so that's
from 2011-04-05-20
to 2011-04-06-01 (included)
(so entries raised from 2011-04-05 20:00 until 2011-04-06 01:59 should be displayed)

so stop grab log entries from 2011-04-06 02 ?
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Changing Unix form to Microsoft Word form to be able to email it to someone.

Please someone I need information on how to change a Unix form/document into a microsoft word document in order to be emailed to another company. Please help ASAP. Thankyou :confused: (8 Replies)
Discussion started by: Cheraunm
8 Replies

2. UNIX for Dummies Questions & Answers

an hour less in 24 hour system

My program: __________________________________ #!/bin/ksh DAY=`date +%y%m%d` H=`date +%H` M=`date +%M` day=`date +%m/%d/%y` let h=$H-1 echo DAY $DAY echo H $H echo M $M echo day $day echo h $h _____________________________________ My result: (3 Replies)
Discussion started by: bobo
3 Replies

3. Shell Programming and Scripting

Formatted Output

Hi I have the following lines in a file SWPRC000001NOT STATED 1344 SWPRC000001NOT STATED 1362 SWPRC000001NOT STATED 1418 SWPRC000001NOT STATED 1436 SWPRC000001NOT STATED ... (6 Replies)
Discussion started by: dhanamurthy
6 Replies

4. Shell Programming and Scripting

More formatted string

In a large file i need last line of the file but I want ignore first charcter, ignore leading zeros after first character and print the remaining character as such. Is something i can do it by tail or wc? cat test1 .... ...... 8000003687 cat test2 .... ...... 8000538990 o/p 3687 538990 (3 Replies)
Discussion started by: ford2020
3 Replies

5. Shell Programming and Scripting

Show previous hour

date +%Y%m%d%H output : 2011031415 I want to get previous hour like this 2011031414. Any one can help ? (15 Replies)
Discussion started by: alvin0618
15 Replies

6. Shell Programming and Scripting

Transpose Data form Different form

HI Guys, I have data in File A.txt RL03 RL03_A_1 RL03_B_1 RL03_C_1 RL03 -119.8 -119.5 -119.5 RL07 RL07_A_1 RL07_B_1 RL07_C_1 RL07 -119.3 -119.5 -119.5 RL15 RL15_A_1 RL15_C_1 RL15 -120.5 -119.4 RL16... (2 Replies)
Discussion started by: asavaliya
2 Replies

7. Shell Programming and Scripting

Remove x lines form top and y lines form bottom using AWK?

How to remove x lines form top and y lines form bottom. This works, but like awk only cat file | head -n-y | awk 'NR>(x-1)' so remove last 3 lines and 5 firstcat file | head -n-3 | awk 'NR>4' (5 Replies)
Discussion started by: Jotne
5 Replies

8. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

9. Shell Programming and Scripting

How to convert 24 hour time to 12 hour timing?

Hi friends, I want to convert 24 hour timing to 12 hour please help me... my data file looks like this.. 13-Nov-2011 13:27:36 15.32044 72.68502 13-Nov-2011 12:08:31 15.31291 72.69807 16-Nov-2011 01:16:54 15.30844 72.74028 15-Nov-2011 20:09:25 15.35096 ... (13 Replies)
Discussion started by: nex_asp
13 Replies
DPKG::Log(3pm)						User Contributed Perl Documentation					    DPKG::Log(3pm)

NAME
DPKG::Log - Parse the dpkg log VERSION
version 1.20 SYNOPSIS
use DPKG::Log; my $dpkg_log = DPKG::Log->new('filename' => 'dpkg.log', 'parse' => 1); DESCRIPTION
This module is used to parse a logfile and store each line as a DPKG::Log::Entry object. METHODS
$dpkg_log = DPKG::Log->new() $dpkg_log = DPKG::Log->new('filename' => 'dpkg.log') $dpkg_log = DPKG::Log->new('filename' => 'dpkg.log', 'parse' => 1 ) Returns a new DPKG::Log object. If parse is set to a true value the logfile specified by filename is parsed at the end of the object initialisation. Otherwise the parse routine has to be called. Filename parameter can be omitted, it defaults to /var/log/dpkg.log. Optionally its possible to specify from or to arguments as timestamps in the standard dpkg.log format or as DateTime objects. This will limit the entries which will be stored in the object to entries in the given timerange. Note that, if this is not what you want, you may ommit these attributes and can use filter_by_time() instead. By default the module will assume that those timestamps are in the local timezone as determined by DateTime::TimeZone. This can be overridden by giving the argument time_zone which takes a timezone string (e.g. 'Europe/Berlin') or a DateTime::TimeZone object. Additionally its possible to override the timestamp_pattern by specifying timestamp_format. This has to be a valid pattern for DateTime::Format::Strptime. $dpkg_log->filename $dpkg_log->filename('newfilename.log') Get or set the filename of the dpkg logfile. $dpkg_log->parse $dpkg_log->parse('time_zone' => 'Europe/Berlin') $dpkg_log->parse('time_zone' => $dt_tz ) Call the parser. The time_zone parameter is optional and specifies in which time zone the dpkg log timestamps are. If its omitted it will use the default local time zone. Its possible to specify either a DateTime::TimeZone object or a string. @entries = $dpkg_log->entries; @entries = $dpkg_log->entries('from' => '2010-01-01.10:00:00', to => '2010-01-02 24:00:00') Return all entries or all entries in a given timerange. from and to are optional arguments, specifying a date before (from) and after (to) which entries aren't returned. If only to is specified all entries from the beginning of the log are read. If only from is specified all entries till the end of the log are read. $entry = $dpkg_log->next_entry; Return the next entry. @entries = $dpkg_log->filter_by_time(from => ts, to => ts) @entries = $dpkg_log->filter_by_time(from => ts) @entries = $dpkg_log->filter_by_time(to => ts) @entries = $dpkg_log->filter_by_time(from => ts, to => ts, entry_ref => $entry_ref) Filter entries by given from - to range. See the explanations for the new sub for the arguments. If entry_ref is given and an array reference its used instead of $self->{entries} as input source for the entries which are to be filtered. ($from, $to) = $dpkg_log->get_datetime_info() Returns the from and to timestamps of the logfile or (if from/to values are set) the values set during object initialisation. SEE ALSO
DPKG::Log::Entry, DateTime, DateTime::TimeZone AUTHOR
Patrick Schoenfeld <schoenfeld@debian.org>. COPYRIGHT AND LICENSE
Copyright (C) 2011 Patrick Schoenfeld <schoenfeld@debian.org> This library is free software. You can redistribute it and/or modify it under the same terms as perl itself. perl v5.10.1 2011-02-26 DPKG::Log(3pm)
All times are GMT -4. The time now is 08:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy