Worked perfectly thanks, uri, and same technique works perfectly in
postgresql regexp_replace for info
On 29 June 2018 at 16:18, Mike Martin wrote:
> Thanks
>
>
> On Fri, 29 Jun 2018, 15:48 Uri Guttman, wrote:
>
>> On 06/29/2018 10:41 AM, Mike Martin wrote:
>>
>> sorry
>> -mm-dd
Thanks
On Fri, 29 Jun 2018, 15:48 Uri Guttman, wrote:
> On 06/29/2018 10:41 AM, Mike Martin wrote:
>
> sorry
> -mm-dd hh:mm:ss.dd
> eg:
> 2018-01-01 12-45-10-456789 to
> 2018-01-01 12:45:10.456789
>
>
>
> please reply to the list and not to me!
>
> then why did you want lookbehind? this
On 06/29/2018 10:41 AM, Mike Martin wrote:
sorry
-mm-dd hh:mm:ss.dd
eg:
2018-01-01 12-45-10-456789 to
2018-01-01 12:45:10.456789
please reply to the list and not to me!
then why did you want lookbehind? this is very easy if you just grab the
time parts and reassemble them as you
On 06/29/2018 09:32 AM, Mike Martin wrote:
Hi
I am trying to convert a string of the format
2018-01-01 16-45-21-654278
to a proper timestamp string
so basically I want to replace all - after the date part
i am not sure what you are trying to do. show the after text that you
want. a proper
Hi
I am trying to convert a string of the format
2018-01-01 16-45-21-654278
to a proper timestamp string
so basically I want to replace all - after the date part
I am getting a bit stuck, lookbehind doesnt seem to work as it includes the
lookbehind on every occurence
last attempt is
s/(?<=
The rest of it:
use Time::Piece;
use CGI::Carp (carpout);
{ local *CGI::Carp::stamp = sub {... };
open( my $log, ">>", "/path/to/error.log") or die $!;
carpout($log);
carp("foo happened");
# close($log)
}
carp("foo again but with module's timestamp");
On Sun, Mar 26, 2017 at 3:04
Shawn may have a different take but I think the "local" is
misplaced and goes out of scope when the call's made.
Here's a potential workaround:
out of scope
On Sun, Mar 26, 2017 at 2:02 PM, SSC_perl wrote:
>> On Mar 26, 2017, at 1:15 PM, Shawn H Corey
> On Mar 26, 2017, at 1:15 PM, Shawn H Corey wrote:
>
> it would mean replacing the subroutine after the module was loaded.
Thanks, Shawn, but I can’t get that to work. Reading perldoc Core
gives me the impression that I’d need to call the new sub, not the
On Sun, 26 Mar 2017 11:28:44 -0700
SSC_perl wrote:
> > On Mar 25, 2017, at 8:58 PM, Jim Gibson
> > wrote:
> >
> > You could also try overriding the supplied function of the imported
> > module with your own version (not sure exactly how that is
> On Mar 26, 2017, at 1:20 AM, X Dungeness wrote:
>
> but you could post-process the logfile in an END {} block
I wouldn't have thought of that. Thanks!
This now gives me a cleaner log to scan — streamlining the timestamp
and adding a blank line between
> On Mar 25, 2017, at 8:58 PM, Jim Gibson wrote:
>
> You could also try overriding the supplied function of the imported module
> with your own version (not sure exactly how that is done).
Hmm… me neither, but it’s a good idea. I’ll contact the maintainer of
ut);
> open(_STDERR,'>'); close STDERR;
> open (my $log, '>>', 'logs/error.log') or warn("Couldn't open
> error.log: $! \n");
> carpout($log);
> close ($log);
> }
>
> However, I would like to change the date form
ose STDERR;
> open (my $log, '>>', 'logs/error.log') or warn("Couldn't open
> error.log: $! \n");
> carpout($log);
> close ($log);
> }
>
> However, I would like to change the date format. I’m not wild about
> seeing the the full timestamp
;);
carpout($log);
close ($log);
}
However, I would like to change the date format. I’m not wild about
seeing the the full timestamp on every line:
[Sat Mar 25 08:05:58 2017]
Is there a way I can format that to my liking? I see there's a
‘noTimestamp’ opt
On 07/26/2013 06:10 AM, Charles DeRykus wrote:
On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader
mbra...@internode.com.au mailto:mbra...@internode.com.au wrote:
[...]
There are at least 2 modules that can definitely do the job for you,
Date::Manip::Date and DateTime (with
On Fri, Jul 26, 2013 at 4:45 AM, Perl Beginners beginners@perl.org wrote:
On 07/25/2013 04:40 PM, Charles DeRykus wrote:
On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader
mbra...@internode.com.au
mailto:mbra...@internode.com.**aumbra...@internode.com.au
wrote:
On 07/25/2013 10:14
On 07/25/2013 03:26 PM, Jim Gibson wrote:
You don't need a module to recognize a date in the form DD-MM- and change
it into the form -MM-DD (untested):
if( $date =~ /^(\d\d)-(\d\d)-(\d\d\d\d)$/ ) {
$date = $3-$2-$1;
}else{
# try other conversions
}
Jim's right, but be aware
On Wed, Jul 24, 2013 at 10:56 PM, Michael Brader
mbra...@internode.com.auwrote:
On 07/25/2013 10:14 AM, mimic...@gmail.com wrote:
I was trying to use Date::Simple to convert date from DD-MM- to ISO
standard -MM-DD, but it produced error below because it returned undef
when the
I was trying to use Date::Simple to convert date from DD-MM- to ISO
standard -MM-DD, but it produced error below because it returned undef
when the date passed is not ISO standard.
$ perl -e 'use Date::Simple (:all);$date =
Date::Simple-new(29-01-1972); $x = $date-as_iso; print $x\n
On 07/25/2013 10:14 AM, mimic...@gmail.com wrote:
I was trying to use Date::Simple to convert date from DD-MM- to ISO
standard -MM-DD, but it produced error below because it returned
undef when the date passed is not ISO standard.
Yeah on quick scan of the perldoc it looks like
On Jul 24, 2013, at 5:44 PM, mimic...@gmail.com wrote:
I was trying to use Date::Simple to convert date from DD-MM- to ISO
standard -MM-DD, but it produced error below because it returned undef
when the date passed is not ISO standard.
You don't need a module to recognize a date
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
;
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
-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); beginners@perl.org
Subject: Re: date format search insdie
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: beginners@perl.org
Subject: RE: date format search insdie the files
Hi David,
Thanks
Sureshkumar M (HCL Financial Services) schreef:
#/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;
#!/usr/bin/perl
use strict;
use warnings;
my $in_name = data.in;
{ open my
5:30 PM
To: beginners@perl.org
Subject: Re: date format search insdie the files
Sureshkumar M (HCL Financial Services) schreef:
#/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;
#!/usr
Sureshkumar M (HCL Financial Services) schreef:
Can you explain me this part how it's works?
(?:\d{2}|\w{3})
?: what this will do?
Read perlre (and find out what (?:) means).
And also, the output is like below
(C)/tmp/d$ perl 1
10-11-81
20-NOV-2008
05-07-1981
15-110-2008
Sureshkumar M (HCL Financial Services) schreef:
Can someone help me on this
Impossible.
--
Affijn, Ruud
Gewoon is een tijger.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
2008/11/22 sftriman [EMAIL PROTECTED]:
On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote:
2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]:
I could be wrong but I don't think \w will not match a hypen - so
the test will fail.
This works for me:
if
Hi All,
I want to find the string which are having the date inside the
file.
Please help me how do I match it,below is my program and it's not
returning anything.
#!/usr/bin/perl
open(DATA,i)||die Unable to open the file;
while(DATA)
{
if($_=~/(\d{2})([\W])\1\2\1]/)
{
2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]:
Hi All,
Hi
#!/usr/bin/perl
# Always use these, particularly when things aren't working as expected.
use strict;
use warnings;
open(DATA,i)||die Unable to open the file;
while(DATA)
{
if($_=~/(\d{2})([\W])\1\2\1]/)
Sureshkumar M (HCL Financial Services) wrote:
Hi All,
Hello,
I want to find the string which are having the date inside the
file.
Please help me how do I match it,below is my program and it's not
returning anything.
#!/usr/bin/perl
use warnings;
use strict;
open(DATA,i)||die Unable to
Dermot wrote:
2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]:
#!/usr/bin/perl
# Always use these, particularly when things aren't working as expected.
use strict;
use warnings;
open(DATA,i)||die Unable to open the file;
while(DATA)
{
if($_=~/(\d{2})([\W])\1\2\1]/)
On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote:
2008/11/22 Sureshkumar M (HCL Financial Services) [EMAIL PROTECTED]:
Hi All,
Hi
#!/usr/bin/perl
# Always use these, particularly when things aren't working as expected.
use strict;
use warnings;
open(DATA,i)||die Unable to
;
}
}
But the same code is working if in the excel file (which i am reading ) i am
using date format as 06\02\2006 ( back ward slash)
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
HARDWAREVERSION)
{
print FILE # . $sheet-Range('A'.$i)-{'Value'} . :\t
.$sheet-Range('B'.$i)-{'Value'}. \n;
}
}
But the same code is working if in the excel file (which i am reading
) i am using date format as 06\02\2006 ( back ward slash)
Thanks
--
To unsubscribe, e-mail: [EMAIL
Hi
I have a list of dates that have been converted to epoch seconds, processed
and then converted back to a string (using timelocal). The resulting date
format is:-
Wed Mar 16 22:10:16 2004
What is the easiest way to convert this format (or epoch seconds) to
16-Mar-2004 22:10 - preferrably
Hi
I have a list of dates that have been converted to epoch seconds,
processed
and then converted back to a string (using timelocal). The resulting date
format is:-
Wed Mar 16 22:10:16 2004
What is the easiest way to convert this format (or epoch seconds) to
16-Mar-2004 22:10
John Bruin wrote:
I have a list of dates that have been converted to epoch seconds,
processed and then converted back to a string (using timelocal).
The resulting date format is:-
Wed Mar 16 22:10:16 2004
What is the easiest way to convert this format (or epoch seconds)
to 16-Mar-2004 22:10
9:35 a.m.
To: John Bruin; [EMAIL PROTECTED]
Subject: Re: Newbie needs help changing date format
Hi
I have a list of dates that have been converted to epoch seconds,
processed
and then converted back to a string (using timelocal). The resulting
date format is:-
Wed Mar 16 22:10:16 2004
[EMAIL PROTECTED] wrote:
I have this code:
my ($month, $day, $year) = (localtime)[4,3,5];
printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900);
which gives me
08/16/2004
what I want is 08/16/04.
perldoc -f localtime describes very clearly how you get a two digit
year. It's advisable to study the
All,
I have this code:
my ($month, $day, $year) = (localtime)[4,3,5];
printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900);
which gives me
08/16/2004
what I want is 08/16/04. Should I just use Posix with strftime or is
there a quicker way w/out having to load the Posix module?
also, why I
[EMAIL PROTECTED] wrote:
All,
I have this code:
my ($month, $day, $year) = (localtime)[4,3,5];
printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900);
which gives me
08/16/2004
what I want is 08/16/04. Should I just use Posix with strftime or is
there a quicker way w/out having to
On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote:
I have this code:
my ($month, $day, $year) = (localtime)[4,3,5];
printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900);
which gives me
08/16/2004
what I want is 08/16/04. Should I just use Posix with strftime or is
there a quicker way w/out having to
Bob Showalter wrote:
($year + 1900) % 100
Actually just
$year % 100
is valid. The former makes it clearer what you're doing, if you're into that
:~)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
[EMAIL PROTECTED] wrote:
All,
I have this code:
my ($month, $day, $year) = (localtime)[4,3,5];
printf (%02d/%02d/%02d\n, $month+1,$day,$year+1900);
which gives me
08/16/2004
what I want is 08/16/04. Should I just use Posix with strftime or is
there a quicker way w/out having to load the
], [EMAIL PROTECTED]
cc:
Subject:RE: date format
Bob Showalter wrote:
($year + 1900) % 100
Actually just
$year % 100
is valid. The former makes it clearer what you're doing, if you're into
that
:~)
Flemming Greve Skovengaard wrote:
printf (%02d/%02d/%02d\n, $month + 1, $day, $year - 100);
# Only works when $year 1999.
And when $year = 2099 :~)
Stick to $year % 100;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Bob Showalter wrote:
Flemming Greve Skovengaard wrote:
printf (%02d/%02d/%02d\n, $month + 1, $day, $year - 100);
# Only works when $year 1999.
And when $year = 2099 :~)
Stick to $year % 100;
Yes, you are correct. Your solution is fool proof.
--
Flemming Greve Skovengaard FAITH, n.
I have this value, from the date format solution emails, in a subroutine
and I want to pass it to a if clause, how would I go about this?
Can I assign a literal such as
sub datemanip {
my ( $month, $day, $year) = (localtime)[4,3,5];
my $foodate = printf (%02d/%02d/%02d\n
On Mon, 16 Aug 2004 [EMAIL PROTECTED] wrote:
sub datemanip
A name like that screams a need for the Date::Manip CPAN module:
http://search.cpan.org/~sbeck/DateManip-5.42a/Manip.pod
Look over the docs for that module, see if you can't use it to do what
you need to do, and let the list know if you
[EMAIL PROTECTED] wrote:
I have this value, from the date format solution emails, in a subroutine
and I want to pass it to a if clause, how would I go about this?
Can I assign a literal such as
sub datemanip {
my ( $month, $day, $year) = (localtime)[4,3,5];
my $foodate
Is there a way in perl to get the month/day/year using localtime
WITHOUT using 'use POSIX qw(strftime)' or a system date call.
Something using slices, maybe something like:
print scalar ((localtime(time))[4,3,7])
expecting the result to be 03122004.
Trivial question, thanks in advance.
Jeff,
Check out
http://www.users.voicenet.com/~corr/macsupt/macperl/localtime.html
Steve
On Fri, Mar 12, 2004 at 01:38:28PM -0800, Jeff Westman wrote:
Is there a way in perl to get the month/day/year using localtime
WITHOUT using 'use POSIX qw(strftime)' or a system date call.
On Fri, 12 Mar 2004, Jeff Westman wrote:
Is there a way in perl to get the month/day/year using localtime
WITHOUT using 'use POSIX qw(strftime)' or a system date call.
Something using slices, maybe something like:
print scalar ((localtime(time))[4,3,7])
expecting the result to
Hello, this guy finally emailed his script to me. The problem he is having
is with $year. Here's the dating part of the code:
---
$date = `/bin/date`;
chop($date);
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
$thisday =
Troy May wrote:
Hello, this guy finally emailed his script to me. The problem he is having
is with $year. Here's the dating part of the code:
---
$date = `/bin/date`;
chop($date);
has this guy considered using Date::Calc?
[ Don't Cc: me, I read this mailing list, thank you ]
Troy May [EMAIL PROTECTED] writes:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
$thisday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime) [6]];
$s = (localtime)[0];
$m = (localtime)[1];
$m = ($m + 35) ;
Is
-
From: Troy May [EMAIL PROTECTED]
To: Beginners CGI List [EMAIL PROTECTED]
Sent: Sunday, March 03, 2002 12:52 AM
Subject: Date format again
Hello, this guy finally emailed his script to me. The problem he is
having
is with $year. Here's the dating part of the code
I am a beginner of Perl. How do I convert and print the following strings
into a date format so that either the date is returned or date not valid
is printed.
Input data is:
792910171010163200
552910171010163200
552913171010163200
552910171010163200
552909171010163200
552909171010163200
www.iraninfocenter.net
www.sorna.net
___
- Original Message -
From: Sandeep Pathare [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, December 04, 2001 08:12 AM
Subject: Converting numbers into date format
I am a beginner of Perl. How do I convert and print the following
into date format
I am a beginner of Perl. How do I convert and print the following strings
into a date format so that either the date is returned or date not valid
is printed.
Input data is:
792910171010163200
552910171010163200
552913171010163200
552910171010163200
Sandeep Pathare wrote:
I am a beginner of Perl. How do I convert and print the following strings
into a date format so that either the date is returned or date not valid
is printed.
Input data is:
792910171010163200
552910171010163200
552913171010163200
552910171010163200
John W. Krahn wrote:
Sandeep Pathare wrote:
I am a beginner of Perl. How do I convert and print the following strings
into a date format so that either the date is returned or date not valid
is printed.
Input data is:
792910171010163200
552910171010163200
552913171010163200
Could someone tell me why this is happening? When I use this command, it
used to give me 20010405.doc (mmdd.doc), now it's giving me 2001 4 5.doc
- I'm losing the leading zeros.
Command is on Perl 5 - printf(\%s%02s%02s.doc,$year,$month,$day).
Thanks.
On Tue, Apr 24, 2001 at 11:00:40AM -0500, Arante, Susan wrote:
: Could someone tell me why this is happening? When I use this command, it
: used to give me 20010405.doc (mmdd.doc), now it's giving me 2001 4 5.doc
: - I'm losing the leading zeros.
: Command is on Perl 5 -
Hi Susan,
I get what you expect:
perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)';
20010405.doc
Personally, I like POSIX.pm for dates.
# perl -MPOSIX -wle 'print strftime(%Y%m%d, localtime) . .doc';
20010424.doc
'perldoc POSIX' to learn more (look for strftime).
Cheers,
Kevin
: Help on Date Format
Hi Susan,
I get what you expect:
perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)';
20010405.doc
Personally, I like POSIX.pm for dates.
# perl -MPOSIX -wle 'print strftime(%Y%m%d, localtime) . .doc';
20010424.doc
'perldoc POSIX' to learn more (look for strftime
On Tue, Apr 24, 2001 at 01:09:13PM -0400, Kevin Meltzer wrote:
Hi Susan,
I get what you expect:
perl -wle '$y=2001;$m=4;$d=5;printf(\%s%02s%02s.doc,$y,$m,$d)';
20010405.doc
[snip]
Well I'll be damned.
[ ~ ] perl -e 'printf %04s\n, 1'
0001
[ ~ ] perl -e 'printf %04s\n, 1'
0001
[ ~ ]
In this case, it wont really matter. Since 1 and 1 is essentially the same.
If you were actually using a signed integer (in decimal), then you would see
the difference:
From perldoc -f sprintf:
%s a string
%d a signed integer, in decimal
[root@fluffhead /]# perl -e 'printf %04s\n,
71 matches
Mail list logo