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.]
•
[4,033 views]

