Click here to get back home

General way to run an exe with errors written to a file

 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
General way to run an exe with errors written to a file bencejohn 09-19-2007
Posted by bencejohn on September 19, 2007, 8:04 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 Ben Morrow on September 19, 2007, 10:08 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
File::Copy.. general questions January 16, 2006, 6:32 pm
use lib "mylibrary" question and general config file... July 30, 2005, 4:08 pm
SOLVED: "Text File Busy" And Other Frustrating NFS/Perl Errors September 12, 2005, 3:36 pm
use CGI::Carp qw(fatalsToBrowser) not sending file handle errors to browser March 1, 2008, 6:17 pm
code written under 5.10.0 to be run under 5.8.8 May 10, 2008, 11:51 pm
rsh daemon written in perl? December 12, 2004, 11:14 pm
new commands written in perl September 21, 2004, 11:57 am
Can services be written in Perl? December 14, 2005, 9:31 pm
Can device drivers be written in Perl? December 9, 2005, 9:55 pm
is there a minimal LDAP server written in Perl? April 13, 2005, 4:12 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap