Click here to get back home

Win32::OLE MS Word line breaks regex

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Win32::OLE MS Word line breaks regex Lance Hoffmeyer 02-03-2007
Posted by Lance Hoffmeyer on February 3, 2007, 6:43 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by Mumia W. (NOSPAM) on February 3, 2007, 8:41 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
Beginner: read $array with line breaks line by line August 27, 2006, 9:40 am
line breaks November 29, 2006, 12:09 am
FormatText/TreeBuilder Removes Line Breaks September 8, 2005, 1:35 pm
Win32::OLE, Microsoft Word July 6, 2007, 2:07 pm
how to install Win32-Word-Writer-0.02 September 3, 2006, 9:07 am
Accessing MS Word fields and DOCVARIABLES with win32:ole? October 17, 2005, 3:10 pm
Win32::OLE - help request - update MS Word document March 2, 2006, 8:41 pm
Last word in line, BUT...!!! September 23, 2005, 4:21 am
FAQ 6.13: How do I process each word on each line? November 30, 2004, 12:03 am
FAQ 6.13 How do I process each word on each line? February 14, 2005, 12:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap