Thunderbird To Procmail

From Biowiki
Jump to: navigation, search

It's very rough & ready but the following one-liner helped me convert my Thunderbird filters to procmail:

cat msgFilterRules.dat | perl -ne 'chomp;if(/^condition=\"OR (.*)\"/){$g=$1;@f=split/ OR /,$g;my@h;for$f(@f){$f=~s/^\((.)(.+)\)/@{[uc($1)]}$2/;$f=~s/,contains,/:\.\*/;push@h,"^$f.*"}print":0:\n* ",join("|\\\n  ",@h),"\n$name\n\n"}elsif(/^name=\"(.+)\"/){$name=$1}'

See also this page which describes the syntax for "or" rules:

http://lipas.uwasa.fi/~ts/info/proctips.html#orrules

-- Ian Holmes - 18 Sep 2007