Skip to content

Instantly share code, notes, and snippets.

@oopsops
Created April 13, 2012 08:51
Show Gist options
  • Save oopsops/2375192 to your computer and use it in GitHub Desktop.
Save oopsops/2375192 to your computer and use it in GitHub Desktop.
SplitTraceLog
#!/usr/bin/perl
#Usage checkLTrace.pl [keyword] [filepath]
#use strict;
#use warnings;
if (@ARGV < 2) { exit(1); };
$grepword = $ARGV[0];
$filename = $ARGV[1];
open(IN, "< $filename");
read (IN, $buf, (-s "$filename"));
close IN;
@list = split(/\n[0-9][0-9]:[0-9][0-9]:[0-9][0-9] /, $buf);
@result = grep(/$grepword/, @list);
print "Latest $grepword --\n";
print "$result[$#result]\n";
print "End --\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment