Click here to get back home

system() commands

 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
system() commands Kim Gardiner CS2003 01-30-2007
Get Chitika Premium
Posted by Kim Gardiner CS2003 on January 30, 2007, 7:12 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 Paul Lalli on January 30, 2007, 8:57 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
system() with 2 commands April 21, 2005, 2:25 pm
Using system Commands In threads January 5, 2006, 2:14 pm
Running system commands June 11, 2006, 11:11 pm
Executing multiple System Commands parallel July 22, 2004, 12:32 pm
Use system to start a server then execute commands on it October 22, 2006, 9:38 am
invoking system commands from a perl script March 10, 2007, 10:47 am
Core dump while calling external commands using system() November 9, 2004, 9:18 am
Net::Telnet and Tk prevent Perl from returning system commands on Windows January 2, 2007, 11:57 am
Net FTP -- Size showing different results on AIX system and Linux system August 7, 2006, 3:54 pm
Return-Code of "system" on a 64-bit system December 17, 2005, 4:35 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap