Thanks, I will do that. It was for perl . On Tue, Oct 23, 2018 at 10:42 AM Jim Gibson <jimsgib...@gmail.com> wrote:
> On Oct 22, 2018, at 9:12 PM, Asad <asad.hasan2...@gmail.com> 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. > > > > file2 : > > > > LOG file opened at 02/03/18 01:11:05 > > > > DUP-05004: statement1 > > DUP-05007: statement2 > > > > > > LOG file opened at 02/03/18 01:11:14 > > > > DUP-05004: statement1 > > > > DUP-05007: statement2 > > > > > > LOG file opened at 02/23/18 01:10:33 > > > > DUP-05004: statement1 > > > > DUP-05007: statement2 > > > > I need to look for the ERR-2001 in file1 if it matches then go to file2 > and print the message nearest to the timestamp found in file1 within two > minutes of range . > > > > so in this case file1 : Fri Feb 23 01:10:28 2018 > > range file1 +2 mins :02/23/18 01:12:28 > > check in file 2 nearest to file1 and within range : 02/23/18 > 01:10:33 > > > > how do i compare two timestamps in different format and within range ? > > You would first convert the two timestamps to a common format, preferably > one that used a numerical value to express times. I know of two such: the > Unix epoch time that uses an integer to represent the number of seconds > since 1 Jan 1970 UTM and the Julian date that uses a floating-point number > to represent the number of days since 1 Jan 4713 BCE. > > Are you looking for a Perl solution or a Python one? > > For Perl, you should investigate time and date modules available on CPAN, > such as Date::Manip or Date::Calc. > > -- Asad Hasan +91 9582111698