Quoth Chip Camden on Monday, 09 August 2010: > Quoth Dennis Yurichev on Tuesday, 10 August 2010: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > On 10-Aug-10 01:15, Chip Camden wrote: > > >> Is there any plugin or script which is able to collect time stamps of > > >> all emails from some specific email address and to draw a statistical > > >> chart answering to question: what hours correspondent is most active in? > > >> > > > Are you using mbox or maildir? > > > > I'm considering to switch to whatever can help me :-) > > > Okay then, this will give you the raw data for mbox. If you want to know > the times that [email protected] sent you mail that's in your Inbox, type: > > mailfrom.rb -f [email protected] ~/Mail/Inbox > > Then you can pipe that to something that computes whatever stats from > those times you want. > > > #!/usr/bin/env ruby > # usage: mailfrom.rb -f from file... > # > # where from is a regular expression for the From: header field value. > # > require "optparse" > > pat = nil > optparse = OptionParser.new do |opts| > opts.banner = 'usage: mailfrom.rb [-f regexp] file...' > > opts.on('-f', '--from REGEXP', 'Specify From: header field filter') do > |from| > pat = Regexp.new("^From:\s*#{from}") > end > end > > begin > optparse.parse! > rescue OptionParser::InvalidOption, OptionParser::MissingArgument => e > puts e > puts optparse > exit 1 > end > in_hdr=false > date = nil > pick = nil > $<.each do |line| > case line > when /^From / > in_hdr = true > date = nil > pick = nil > when /^Date: (.*)/ > if in_hdr > date = $1 > puts date if pick > end > when pat > if in_hdr > puts date if date > pick = true > end > when /^\s*$/ > in_hdr = false > end > end > > -- > Sterling (Chip) Camden | [email protected] | 2048D/3A978E4F > http://camdensoftware.com | http://chipstips.com | > http://chipsquips.com
actually, correct line 13 of the above script to read:
pat = Regexp.new("^From:.*#{from}", Regexp::IGNORECASE)
That way you don't need the whole "From:" value, just a piece of it, and
you don't have to worry about uppercase.
--
Sterling (Chip) Camden | [email protected] | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com | http://chipsquips.com
pgpOodSR3jpKq.pgp
Description: PGP signature
