Click here to get back home

long 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
long lines Xenos 10-28-2004
`--> Re: long lines Gunnar Hjalmars...10-28-2004
Posted by Xenos on October 28, 2004, 12:25 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 Gunnar Hjalmarsson on October 28, 2004, 6:44 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
--chop-long-lines April 2, 2007, 10:04 am
split long string over two lines June 15, 2005, 10:22 pm
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
'long long integer' in Perl February 15, 2006, 2:30 pm
How long is too long for cgi script? April 22, 2005, 12:07 pm
How to unpack long long ? June 12, 2008, 9:51 am
How to unpack long long ? June 12, 2008, 9:52 am
How to break the lines in printing to html lines? July 5, 2006, 11:21 pm
perl -pe for blocks of lines instead of single lines September 26, 2006, 1:29 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap