Search Results

Search: Posts Made By: Epiphone
88,682
Posted By Epiphone
So I'm using the tmpfile solution as already...
So I'm using the tmpfile solution as already discussed in this thread. But What I'm currently doing is using 2 Find commands, 1 which finds everything with mtime in between the 2 temp files and the...
63,344
Posted By Epiphone
ahh it is working but the search im doing is only...
ahh it is working but the search im doing is only searching the first line

2007/05/25 15:51:36.958117 sdfsdfsdf sdfdsfds-sdfds Trace name: STRINGB
sdfsdfsdfsdfsdfsdfsdfsdfsdff
sdfsdfsdfsdfsd...
63,344
Posted By Epiphone
I mean if I add STRINGC if ( $_ ge...
I mean if I add STRINGC

if ( $_ ge "2007/05/25 16:05" && $_ le "2007/05/25 16:08" && /STRINGC/ && /STRINGB/ ) {

It doesnt work, what am i doing wrong?
88,682
Posted By Epiphone
I have a load of logfiles, Jul 5 07:03...
I have a load of logfiles,

Jul 5 07:03 MSG_sdfd_dsfsdf_sdfsdfsdf_070705_123116.gz
Jul 6 08:03 MSG_sdf_sdfsdfsd_sdfsdf_070705_181255.gz
Jul 6 14:03 MSG_sdf_sdfsdf_sdfdsfsdf_070705_224108.gz...
63,344
Posted By Epiphone
back again while( <FILE> ) { if...
back again

while( <FILE> )
{
if ( $_ ge "2007/05/25 16:05" && $_ le "2007/05/25 16:08" && /STRINGB/ ) {
$results = $results . $_;
$flag=3;
}
...
63,344
Posted By Epiphone
yeah, seems to be working, great. Your a...
yeah, seems to be working, great.

Your a credit to this forum anbu23, thanks.
63,344
Posted By Epiphone
I want to run a script which filters out the...
I want to run a script which filters out the contents of the file by:
Date
Time
String

But I want it to also filter out time ranges!

Here is log file:

2007/05/25 15:51:36.958117 sdfsdfsdf...
63,344
Posted By Epiphone
#!/usr/local/bin/perl ##################...
#!/usr/local/bin/perl

################## Constructors

use XML::Simple;

use Time::HiRes qw(gettimeofday tv_interval);

use File::Path;

$xml = new XML::Simple;

$xml1 = new XML::Simple;...
63,344
Posted By Epiphone
$results = $results . $_ if ( ( $_ ge "$date...
$results = $results . $_ if ( ( $_ ge "$date $time" && $_ le "$date2 $time2" ) || m/$sap/ )

The code above is returning everything again and being filtered? Where using & instead of || seems to...
63,344
Posted By Epiphone
and also, currently this only returns the line of...
and also, currently this only returns the line of text which the match appears on. I need to get the next 2 lines also. What is that code? thanks
63,344
Posted By Epiphone
Adding the & m/$sap/ works for matching other...
Adding the & m/$sap/ works for matching other text in the file also, u agree?

open FILE , $log;

while( <FILE> )

{
$results = $results . $_ if ( $_ ge "$date $time" && $_ le "$date2...
63,344
Posted By Epiphone
the log file actually contains more than just the...
the log file actually contains more than just the date and time of course

2007/05/25 15:51:36.957753 dsfsdf dsfdfdf-sdfdfdf Trace name: sfsdfdsf

So shall i just add .* after the time like with...
63,344
Posted By Epiphone
just realised this is not working at all, just...
just realised this is not working at all, just gives me back every line and not filtering by the date and time etc

runing:

perl -ne ' print if ( $_ >="2007/05/20 15:13" && $_ <= "2007/08/19...
63,344
Posted By Epiphone
ahh ok I get it. Last question now hopefully. ...
ahh ok I get it. Last question now hopefully.

I already have assigned a variable to the name of the log = $log

so instead of the while (<>) which is just reading from the argument, how can I...
63,344
Posted By Epiphone
In the above code, where I am specifying my log...
In the above code, where I am specifying my log file to read from, in your previous codes "filename"?
63,344
Posted By Epiphone
oh where has reading in the file gone?
oh where has reading in the file gone?
63,344
Posted By Epiphone
OK, that also works from the command prompt. ...
OK, that also works from the command prompt.

But I am trying to incorporate it into my script so therefore:

I need to assign the results of the search to a variable.
Do I need to assign to...
63,344
Posted By Epiphone
hmm yes......anyway I dont know how, hence...
hmm yes......anyway

I dont know how, hence asking here.
63,344
Posted By Epiphone
yes is working in the shell (command prompt) but...
yes is working in the shell (command prompt) but not when running as part of perl script?.

How can I incorporate that into my perl script?
63,344
Posted By Epiphone
im using, is this compatible: SuSE Linux 9.3...
im using, is this compatible:
SuSE Linux 9.3 (i586)
VERSION = 9.3

'$0>=from&&$0<=to' is ensuring that the $0 is in between the from and 2 dates specified.

How can I run this in perl?

Im...
63,344
Posted By Epiphone
grep a log file between 2 dates
Hi

Currently I can grep a log file with the following command:

$results = `grep -A 2 '^$date.$time.*' $log`;

and the following arguments:

$date = 2007/04/25
$time = 16:07

Log example:...
Showing results 1 to 21 of 21

 
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy