Sponsored Content
Full Discussion: formating date
Top Forums Shell Programming and Scripting formating date Post 302101655 by jim mcnamara on Wednesday 3rd of January 2007 04:30:44 PM
Old 01-03-2007
Code:
sql > SELECT                                                                  
   SYSDATE - TO_DATE('2006-12-29 12:57:08','YYYY-MM-DD HH:MI:SS')       
FROM DUAL;                                                              

SYSDATE-TO_DATE('2006-12-2912:57:08','YYYY-MM-DDHH:MI:SS')
----------------------------------------------------------
                                                5.06428241

This User Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Formating in Echo?

Hi, In my code: echo " Field1 " " Filed2 " " Filed3 " >> $myfile echo "--------" "------- " "--------">> $myfile echo $value1 $value2 $value3 >> $myfile echo $value1 $value2 $value3 >> $myfile echo $value1 $value2 $value3 >> $myfile My file... (4 Replies)
Discussion started by: redlotus72
4 Replies

2. Shell Programming and Scripting

Output formating

Dear All I am stuck in one problem. Kindly help me. I am taking below mention file as input file and want some op file as mention below. Kindly send me all possible suggestion and query. Thnaks Jaydeep bELOW IS THE INPUT FILE: *** Connected to BSCANGR ***... (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies

3. Shell Programming and Scripting

Date Formating in Perl

Hi All, Can anybody tell me why is there a "0" in my output of $date_today ? #!/usr/local/bin/perl $date_today = system "date '+%y%m%d'"; print "$date_today\n"; Output: $ perl test4 080908 0 (3 Replies)
Discussion started by: Raynon
3 Replies

4. Shell Programming and Scripting

Text formating

Dear all I had input file as mention below and want op as mention. Kindly let me knw possible ways. Regards Jaydeep INPUT: RXOTX-48-1 2A 34 2B 35 RXOTX-499-2 2C 32 RXOTX-4-1 2D 23 OUTPUT: (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

5. Shell Programming and Scripting

Formating output

Hello Team i have a file with following data (as columns). I need implement a syntax like below for altering table ALTER TABLE1 TABLENAME ADD COLUMN COL1 CHAR(5) NOT NULL WITH DEFAULT ADD COLUMN COL2 CHAR(5) .. .. ADD COLUMN COLn CHAR(5) NOT NULL... (1 Reply)
Discussion started by: rocking77
1 Replies

6. UNIX for Dummies Questions & Answers

Help with formating when using mailx

Hi I am a newbie here. I tried searching for the solution but I guess I either didn't find it or there hasn't been one posted. my problem is I spooled the results of a query into a .txt file. When I cat the file the formating looks great. All the columns are aligned. However once I mailx the... (2 Replies)
Discussion started by: RB26DETT
2 Replies

7. Emergency UNIX and Linux Support

Question on time and date formating..

can anyone one help me....to make date and time format...to following format for my file DATE TIME DD- MON- YEAR 24 Hours I have a need of format like this 12-Jan-2012 in one column, then time in 24 Hours in another column....please help...me... ... (4 Replies)
Discussion started by: nex_asp
4 Replies

8. Shell Programming and Scripting

Formating questions

Hi, I have a data as follows in some files, i want to change CHAR(2-20) to VARCHAR(2-20). I should not touch any line with CHAR(1) Example: Input: cur_rev_stage_cd CHAR(5) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL, prev_rev_stage_cd CHAR(5) CHARACTER SET LATIN NOT... (7 Replies)
Discussion started by: srikanth38
7 Replies

9. UNIX for Beginners Questions & Answers

File formating help

Hi all, I am having the file below I need that as below Thanks, Arun (12 Replies)
Discussion started by: arunkumar_mca
12 Replies

10. Shell Programming and Scripting

File formating

I need to create a fixed width file based on the column lengths. lets assume I have six(this may be dynamic) fields each are of different length column1=6 #size of the column column2=3 column3=2 column4=3 column5=4 column6=5 I tried below code snippet but it is not working echo... (4 Replies)
Discussion started by: gvkumar25
4 Replies
Syslog(3pm)						  LogReport's Lire Documentation					       Syslog(3pm)

NAME
Lire::Syslog - syslog style lines parser SYNOPSIS
use Lire::Syslog; my $parser = new Lire::Syslog; my $rec = $parser->parse( $line ); DESCRIPTION
This module defines objects able to parse logs coming from several flavours of logging daemon. It currently supports the following syslog file formats: Classic BSD syslog daemon The "classic" BSD syslog format: MMM DD HH:MM:SS Hostname Message Solaris 8 syslog daemon The Solaris 8 syslog daemon also includes the facility and level: MMM DD HH:MM:SS Hostname Process[Pid]: [ID DDDDDD Facility.Level] Message Netscape Messaging Server logging daemon The syslog daemon that comes with Netscape Messaging Server uses a date in common log format: [DD/MMM/YYYY:HH:MM:SS +ZZZZ] Hostname Process[Pid]: Facility Level: Message WebTrends syslog daemon The format used by the syslog daemon that comes with WebTrends: WTsyslog[YYYY-MM-DD HH:MM:SS ip=HOSTNAME pri=WT_PRIORITY] <XX>Message Kiwi Syslog (ISO date format) The ISO log file formats used by the Kiwi Syslog daemon (http://www.kiwisyslog.com/info_sysd.htm), a logging daemon often encountered on Win32 platforms: YYYY-MM-DD HH:MM:SS [TAB] Facility.Level [TAB] Hostname [TAB] Message Kiwi Syslog (US date format) The US date format used by the Kiwi Syslog daemon: MM-DD-YYYY HH:MM:SS [TAB] Facility.Level [TAB] Hostname [TAB] Message Kiwi Syslog (DD-MM-YYY date format) The DD-MM-YYYY date format used by the Kiwi Syslog daemon: DD-MM-YYYY HH:MM:SS [TAB] Facility.Level [TAB] Hostname [TAB] Message Sendmail Switch logging daemon The format used by the logging daemon coming with Sendmail Switch on Win32 platforms: MM/DD/YY HH:MM:SS Process(Pid): Level: Message RFC 3164-compliant Syslog daemon A format from RFC 3164-compliant Syslog daemons which includes the encoded priority and the year in the date. RFC 3164 defines the "BSD Syslog Protocol". <Priority>MMM DD YYYY HH:MM:SS: Process[Pid]: Message The first time the parse() method is used, the parser will try each of the supported formats to detect the syslog format. If no format matches, the module will call lr_err() and abort the program. Each other parse() invocation will use the same format. The parse() method will return an hash reference which contains the following keys: timestamp The timestamp of the event. hostname The name or IP address of the host that sended the message. process The "process" that logged the event. Formally, the syslog message doesn't contain a process field but its usually the first word coming before a colon in the message's content. pid The PID of the process that logged the event. This is usually what is between [] in the process part of the message. identifier This key is only present when the log comes from a Solaris 8 syslog daemon. It contains the identifier that comes after ID in the message. facility The syslog facility (kern, mail, local0, etc.) of the message. This isn't supported in all file formats so this key might be unavailable. level The syslog level (emerg, info, notice, etc. ) of the message. This isn't supported in all file formats so this key might be unavailable. content The actual syslog message (with the process and pid removed). Many network devices will also have another BSD-style timestamp at the beginning of the message. If present, it will also be removed. USAGE
package Lire::Foo; use base qw/ Lire::Syslog /; sub parse { my $self = shift; my $line = shift; # this runs parse from Lire::Syslog, setting keys like 'day', 'process' # and 'hostname' my $rec = $self->SUPER::parse($line); $rec->{'foo'} = dosomethingwith( $rec->{'content'} ); return $rec } Now, one can run in a script my $parser = new Lire::Foo(); while ( <> ) { chomp; my $log = $parser->parse( $line ); } which sets $log->{'day'}, ... $log->{'process'} and $log->{'foo'}. SEE ALSO
Lire::Email(3) AUTHORS
Joost van Baal, Francis J. Lacoste. Initial idea by Joost Kooij VERSION
$Id: Syslog.pm,v 1.15 2006/07/23 13:16:30 vanbaal Exp $ COPYRIGHT
Copyright (C) 2000-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 Syslog(3pm)
All times are GMT -4. The time now is 05:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy