Click here to get back home

redirecting stdout/stderr to logfile

 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
redirecting stdout/stderr to logfile dmedhora 05-24-2006
Posted by dmedhora on May 24, 2006, 9:59 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 A. Sinan Unur on May 25, 2006, 9:01 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

Similar ThreadsPosted
RE to extract infos from a logfile October 20, 2004, 2:03 am
how to find the "yesterday" logfile name? March 2, 2007, 4:04 am
threads and logfile rotation July 30, 2007, 12:56 pm
problems appending an entry to a logfile October 15, 2006, 2:02 am
RE-Redirecting STDOUT September 2, 2004, 11:24 am
Redirecting output July 7, 2005, 4:26 am
Temporarily redirecting STDOUT September 5, 2004, 11:43 pm
Redirecting STDOUT to a file April 25, 2006, 12:53 pm
redirecting system output July 23, 2006, 4:55 pm
Redirecting stdout without the use of IO::String May 4, 2007, 3:59 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap