Click here to get back home

How to redirect STDOUT &STDERR?

 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
How to redirect STDOUT &STDERR? news.hinet.net 08-04-2004
Get Chitika Premium
Posted by news.hinet.net on August 4, 2004, 3:21 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 Jim Gibson on August 3, 2004, 1:46 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
How to redirect stderr to C lang function September 11, 2005, 7:21 pm
How to redirect stderr to C lang function September 12, 2005, 3:59 pm
system command - redirect also the STDERR to a file October 16, 2006, 8:26 am
selecting STDOUT AND STDERR December 20, 2004, 1:59 pm
pipe for stderr and stdout March 26, 2008, 7:17 pm
splitting stderr/stdout without using file April 27, 2006, 7:22 am
redirecting stdout/stderr to logfile May 24, 2006, 9:59 pm
WinNT ActiveState STDERR and STDOUT August 24, 2006, 11:35 pm
daemonizing a process AND capture stdout, stderr January 14, 2005, 8:00 pm
Take over STDOUT / STDERR for Perl embedded in C application October 4, 2005, 5:43 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap