• Hail Guest!
    We're looking for Community Content Contribuitors to Stratics. If you would like to write articles, fan fiction, do guild or shard event recaps, it's simple. Find out how in this thread: Community Contributions
  • Greetings Guest, Having Login Issues? Check this thread!
  • Hail Guest!,
    Please take a moment to read this post reminding you all of the importance of Account Security.
  • Hail Guest!
    Please read the new announcement concerning the upcoming addition to Stratics. You can find the announcement Here!

OT: Mass editing (search/replace) Outlook MSG files?

Wulf2k

Stratics Legend
Stratics Veteran
Stratics Legend
At work we've got a document management system in place here. The specifics don't matter, but suffice it to say, some of the HTML Outlook messages were converted incorrectly when being imported into the system. It turned
Code:
<STYLE>@font-face {
    font-family: Tahoma;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; }
P.MsoNormal {
    FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"

blah blah blah

DIV.Section1 {
    page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-CA vLink=purple link=blue>
Into

Code:
<STYLE>@font-face &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; font-family: Tahoma;@page Section1 size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; P.MsoNormal &nbsp;&nbsp;&nbsp;&nbsp; FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"LI.MsoNormal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"DIV.MsoNormal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"A:link &nbsp;&nbsp;&nbsp;&nbsp; COLOR: blue; TEXT-DECORATION: underlineSPAN.MsoHyperlink &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR: blue; TEXT-DECORATION: underlineA:visited &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR: purple; TEXT-DECORATION: underlineSPAN.MsoHyperlinkFollowed &nbsp;&nbsp;&nbsp;&nbsp; COLOR: purple; TEXT-DECORATION: underlineP.MsoAutoSig &nbsp; FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"LI.MsoAutoSig &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"DIV.MsoAutoSig &nbsp;&nbsp;&nbsp;&nbsp; FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"SPAN.EmailStyle17 &nbsp; COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-composeDIV.Section1 &nbsp;&nbsp;&nbsp; page: Section1</STYLE></HEAD><BODY lang=EN-CA vLink=purple link=blue>
For those too disinterested to check, it removed all {, }, and carriage returns.

The resulting HTML showed up fine in Outlook XP/2003, but when viewed in Outlook 2007 all these messages are missing the first paragraph of the message. Adding a single carriage return before the <body> tag makes everything all pretty again.

My question:
Does anybody know of any way of doing a search/replace in MSG files to change
</head><body>

into
</head>
<body>
?

I'd try write a little utility to do it myself, but Outlook doesn't store the HTML in plaintext. Except for when it does. Damn inconsistent file formats....

We're talking about 1,000,000ish msg files to search through, though a smaller number of them will be HTML, and of those, not 100% are affected.
 
O

Old Man of UO

Guest
Ya... I hate that when I am building web pages and spaces get turned into non-breaking spaces once it is rendered.

I don't know anything about this utility, but there are several you can find on a Google search that claim to search and replace characters across multiple files. What a headache!

http://www.funduc.com/search_replace.htm
 

Harlequin

Babbling Loonie
Stratics Veteran
Stratics Legend
If they come in multiple formats, you might want to consider dealing with them as if they are all binary files. For binary files, you can try using a hex editor. Esp if the header information are all at the same offset.

I haven't tried this program before, but looks like it might make things easier for you:

http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm



Has sample scripts/commands to show you how to verify whether a specific string is at a specific address, and only replace it with something else if true.:

http://www.chmaas.handshake.de/delphi/freeware/xvi32/xviscr.htm
 
Top