Click here to get back home

split long string over two lines

 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
split long string over two lines TechCrazy 06-15-2005
Get Chitika Premium
Posted by jbl on June 17, 2005, 1:22 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
Perl Split on a Long Sentence Question October 9, 2006, 12:37 pm
long lines October 28, 2004, 12:25 pm
--chop-long-lines April 2, 2007, 10:04 am
m// on very long lines leaks memory March 13, 2008, 5:26 pm
printLDIF wraps long lines of text October 22, 2004, 3:07 pm
Perl Split lines into array?? December 15, 2005, 11:02 pm
split a multiple lines text October 20, 2008, 5:42 am
Using RE's to match a word split across lines? September 14, 2004, 8:25 pm
string and hash [quite long] November 28, 2005, 9:22 pm
Index of first and last non-"\xff" in a long string November 12, 2007, 1:22 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap