Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread armando perez pena
Dear All, This is a Perl place for Python there are many places. BR, Armando El 25/10/18 a las 17:17, Chris Fedde escribió: why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad mailto:asad.hasan2...@gmail.com>> wrote: Hi , Yes i have the code : import re import datetime

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Chris Fedde
why post a python solution here? On Thu, Oct 25, 2018 at 8:58 AM Asad wrote: > Hi , > > Yes i have the code : > > import re > import datetime > from datetime import timedelta > > Header = "*" > > f3 = open ( r"D:\QI\logA.txt", 'r' ) > string =

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Asad
Hi , Yes i have the code : import re import datetime from datetime import timedelta Header = "*" f3 = open ( r"D:\QI\logA.txt", 'r' ) string = f3.read () regex = re.compile ( "\n" ) st = regex.sub ( " ", string ) st1 = st.split ( " " ) if

Re: How to compare timestamp in two different files(regex)

2018-10-25 Thread Jim Gibson
(Please reply to the list.) If you have written code that extracts the date and time from the ‘LOG flle opened’ lines in the log file, then please show us your code. You seem to be asking other people to write your program for you. You will get better help if you appear to be making an effort

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Jim Gibson
> On Oct 24, 2018, at 9:54 PM, Asad wrote: > > Thank all now I am able to progress : > > file1 i am able to extract the start and end timestamp > file 2 i am able to extract the timestamp > > used the following > my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Asad
Thank all now I am able to progress : file1 i am able to extract the start and end timestamp file 2 i am able to extract the timestamp used the following my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'); coming from file1 my $t2 = Time::Piece->strptime('02/23/18

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Martin McCormick
Someone brought to my attention that I had failed to define a couple of variables in the sample code I posted and they were quite right. I don't mind sharing my work but the entire application I wrote to get a brief local weather summary is 242 lines and I was trying to stay close to the topic,

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Andy Bach
===> I am using the following regex : ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\s[0-9]{4}) > Both are working as expected I would like to know if these are good regex or it can be better , please suggest . Concurring with the others, your setting yourself up for trouble with the

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Chris Fedde
I cannot emphasize enough how fragile the perhaps obvious regex based comparisons of timestamps can be. I second the approach demonstrated by Илья Рассадин above. There are subtle and difficult to debug problems buried in timestamps. Not least of which is locale ambiguity, discontinuities like

Re: How to compare timestamp in two different files(regex)

2018-10-24 Thread Olivier
Hi, > Thank you all for the reply it is working for me . > > 1) for 02/23/18 01:10:33 ==> I am using the following regex > \d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9] > 2) Feb 23 01:10:28 2018 > > I am using the following regex : >

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Asad
Thank you all for the reply it is working for me . 1) for 02/23/18 01:10:33 ==> I am using the following regex \d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9] 2) Feb 23 01:10:28 2018 > I am using the following regex : ([A-Z][a-z]{2}\s)([0-9]{2}\s[0-2][0-9](:[0-5][0-9]){2}\s[0-9]{4})

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Andy Bach
> first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex Look at perldoc -f stat ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($filename); Not all

Re: How to compare timestamp in two different files(regex)

2018-10-23 Thread Asad
Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can suggest the correct regex for both

Re: How to compare timestamp in two different files

2018-10-23 Thread Илья Рассадин
use Time::Piece; my $t1 = Time::Piece->strptime('Feb 23 01:10:28 2018', '%b %d %H:%M:%S %Y'); my $t2 = Time::Piece->strptime('02/23/18 01:10:33', '%m/%d/%y %H:%M:%S'); if ($t1 > $t2) { ... } On 23/10/2018 09:17, Asad wrote: Hi All ,         first hurdle is how do I extract this Feb 23

RE: How to compare timestamp in two different files

2018-10-23 Thread Duncan Ferguson
timestamp in two different files Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can

Re: How to compare timestamp in two different files

2018-10-23 Thread Asad
Hi All , first hurdle is how do I extract this Feb 23 01:10:28 2018 from file1 which regex can I use ? convert it into epoch then regex for 02/23/18 01:10:33 is required ? convert into epoch So if you can suggest the correct regex for both

Re: How to compare timestamp in two different files

2018-10-22 Thread Asad
Thanks, I will do that. It was for perl . On Tue, Oct 23, 2018 at 10:42 AM Jim Gibson wrote: > On Oct 22, 2018, at 9:12 PM, Asad wrote: > > > > file1 : > > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > > > Bootstrapping registry and package to current

Re: How to compare timestamp in two different files

2018-10-22 Thread Jim Gibson
On Oct 22, 2018, at 9:12 PM, Asad wrote: > > file1 : > Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 > > Bootstrapping registry and package to current versions...done > statement ERR-2001: table is corrupt check for cause > > could not determine the current status. >

How to compare timestamp in two different files

2018-10-22 Thread Asad
file1 : Patching tool version 12.1.0.2.0 Production on Fri Feb 23 01:10:28 2018 Bootstrapping registry and package to current versions...done statement ERR-2001: table is corrupt check for cause could not determine the current status. file2 : LOG file opened at 02/03/18 01:11:05 DUP-05004: