Click here to get back home

perl & heredoc to create xml

 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
perl & heredoc to create xml LHradowy 02-28-2007
Get Chitika Premium
Posted by LHradowy on February 28, 2007, 10:42 am
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 Tad McClellan on February 28, 2007, 8:05 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
One-Liner Help with -e + ksh heredoc October 4, 2006, 2:50 pm
HEREDOC tricks, etc. October 28, 2007, 5:13 pm
why the following HereDoc print don't work? December 8, 2004, 11:17 am
Firefox and heredoc problem February 1, 2006, 9:47 am
How to create a folder in ftp using perl August 8, 2006, 12:49 am
Want to create a website using perl and CGI December 17, 2006, 11:58 pm
create columns from lines in perl October 26, 2005, 3:52 pm
how to create persisitent tcp connections using perl November 18, 2005, 2:23 am
Using Perl to create TCP/ActiveX object? February 21, 2006, 9:36 am
Perl and Dos Batch File Create October 18, 2006, 11:58 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap