RE: date format search insdie the files

2008-11-29 Thread Sureshkumar M (HCL Financial Services)
Hi all ,

 

Can someone help me on this

 



From: Sureshkumar M (HCL Financial Services) 
Sent: Saturday, November 29, 2008 4:21 PM
To: 'David Schmidt'
Cc: [EMAIL PROTECTED]
Subject: RE: date format search insdie the files

 

Hi David,

 

  Thanks for the reply, but still I am not able to get expected
output from this.

Pls help me how to get this.

 

(C)/tmp/d$ cat a1

 

115-06-1979

10-11-81

20-NOV-2008

05-07-1981

welcome

20-03-20009

15-10-2008

 

 

(C)/tmp/d$ cat 1

#/usr/bin/perl

 

use strict;

use warnings;

 

open(DATA,a1)||dieUnable to open the file;

 

while(DATA)

{

#if($_=~/\d\d\D(\d\d|\[a-zA-Z]{3})\D\d\d/)

if(/(\d{2}-(\d{2})|(\w{3})-\d{1,4})/)

{

#print $_;

print ;

}

}

close(DATA);

exit 0;

 

(C)/tmp/d$ perl 1   

115-06-1979

10-11-81

20-NOV-2008

05-07-1981

20-03-20009

15-10-2008

(C)/tmp/d$

 

 

 

 

 

 

 

 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
David Schmidt
Sent: Saturday, November 29, 2008 3:12 PM
To: Sureshkumar M (HCL Financial Services); [EMAIL PROTECTED]
Subject: Re: date format search insdie the files

 

You missed some parentheses

 

#!/usr/bin/perl

 

use strict;

use warnings;

 

open(DATA, '', data) || dieUnable to open the file;

while(DATA) {

#if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/) {

if(/(\d{2}-(\d{2})|(\w{3})-\d{1,4})/) {

print;

}

}

close(DATA);

exit 0;

 

 

On Sat, Nov 29, 2008 at 10:11 AM, Sureshkumar M (HCL Financial

Services) [EMAIL PROTECTED] wrote:

 Hi All,

 

I try to search the string which has the date format inside

 the file,

 

 But i am not able to get the desired files. Pls help me on this..

 

 

 

 

 

 

 

 C)/tmp/sms/perl$ cat a1

 

 

 

 115-06-1979

 

 10-11-81

 

 20-NOV-2008

 

 05-07-1981

 

 welcome

 

 15-10-2008

 

 12-03-20009

 

 

 

 

 

 (C)/tmp/sms/perl$ cat 1

 

 

 

 #/usr/bin/perl

 

 open(DATA,a1)||dieUnable to open the file;

 

 

 

 while(DATA)

 

 {

 

 if($_=~/\d{2}-(\d{2}|\w{3})-\d{1,4}/)

 

 {

 

 print $_;

 

 }

 

 }

 

 close(DATA);

 

 exit 0;

 

 (C)/tmp/sms/perl$

 

 

 

 

 

 

 

 Output should be  :

 

 

 

 10-11-81

 

 20-NOV-2008

 

 05-07-1981

 

 15-10-2008

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-- 

David Schmidt   |   http://www.fm5.at



Re: date format search insdie the files

2008-11-29 Thread Dr.Ruud
Sureshkumar M (HCL Financial Services) schreef:

 Can someone help me on this

Impossible. 

-- 
Affijn, Ruud

Gewoon is een tijger.


Re: date format search insdie the files

2008-11-29 Thread Jonathan Leffler
On Sat, Nov 29, 2008 at 3:46 AM, Sureshkumar M (HCL Financial Services) 
[EMAIL PROTECTED] wrote:

 Can someone help me on this


The script does not contain 'use DBI;' which almost automatically makes it
an inappropriate question for the dbi-users@perl.org mailing list.  You
definitely need to read http://www.catb.org/~esr/faqs/smart-questions.html
before posting to dbi-users@perl.org again.

You might consider using Date::Manip or the DateTime::* family of modules.
There are also a myriad other date and time modules on CPAN (
http://search.cpan.org/).  The chances are someone has implemented what you
want.

-- 
Jonathan Leffler [EMAIL PROTECTED]  #include disclaimer.h
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
Blessed are we who can laugh at ourselves, for we shall never cease to be
amused.