Re: A script for fixing bare newlines in mailbox files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





--On Thursday, January 11, 2007 17:35 -0500 Zachariah Mully <zmully@xxxxxxxxxxxxxx> wrote:

Howdy all-
	We've been bitten by migrating some of our people from Outlook to
Thunderbird, and then using Tbird to move their mail off their local
machines onto the IMAP server where it belongs. Unfortunately we've not
patched Cyrus to accept bare newlines, nor intend to... Since I have
access to the local mailboxes does anybody have a perl script or
something of the like that would remove the bare newlines from the raw
mailbox files? My perl-fu sucks this days, and I've not been able to
figure where and how to remove them...


When moving from U Wash to Cyrus we applied this rewrite to all
mailboxes.  Get rid of any nulls while you're at it.


while(<>) {

   # The \000 character (NUL) is not allowed
   if ($line =~ s/\000//g) {
      print STDERR "WARNING: Removing NUL\n";
   }

   # Change CRLF or bare CR to LF
   $endcr = $midcr = 0;
   $endcr++ if ($line =~ s/\015$//g); # \n already there
   $midcr++ if ($line =~ s/\015/\n/g); # add \n
   if ($endcr || $midcr) {
      print STDERR "WARNING: Correcting CR characters\n";
    }


   print;
}


Joseph Brennan
Lead Email Systems Engineer
Columbia University Information Technology

----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux