Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A simple Perl script to search iChat logs UNIX
Here's a simple command-line script to search iChat logs. How to use: ./ichatfind querystring [buddyname]
#!/usr/bin/perl
$path_to_ichats = $ENV{HOME} . "/Documents/iChats/";
$string         = $ARGV[0];
$buddy          = $ARGV[1];

unless($string){
    @buddies = &getbuddies($path_to_ichats);
    for(@buddies) {
        $_ =~ s/^\///;  
        if(($_)&&($_ !~ /^\./)) {
            push (@buddylist,$_);
        }
    }
    print "\nusage: $0 querystring [buddyname]\n\n";
    print "(btw here is your buddy list: ";
    print join(', ',@buddylist);
    print ")\n\n";
    exit;
}

$cmd = "strings $path_to_ichats$buddy* | grep -i $string";
print `$cmd`;

sub getbuddies() {
    my $path = shift;
    @all_chat_logs = `find $path`;
    
    #get uniques
    %seen = ();
    foreach $item (@all_chat_logs) {
        ($buddy,$trash) = split(' ',$item,2);
        $buddy =~ s/^$path//;
        $seen{$buddy}++;
    }
    @uniq = keys %seen;
    return @uniq;
}
[robg adds: Save the script and make it executable (chmod 755 ichatfind), and it works as described. I still prefer Logorrhea, given its nice GUI and highlighting of matched terms, but this is a quick and easy alternative.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,033 views]  

A simple Perl script to search iChat logs | 0 comments | Create New Account
Click here to return to the 'A simple Perl script to search iChat logs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.