Click here to get back home

reading command line options from 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
reading command line options from a file Risto Vaarandi 04-18-2006
Get Chitika Premium
Posted by Risto Vaarandi on April 18, 2006, 7:11 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 April 18, 2006, 8:30 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
Where's the doc. on perl command-line options? August 31, 2004, 1:14 am
How to send command line options into test scripts? August 9, 2006, 3:25 pm
Having problems parsing command line options using Getopt::Long on windows December 2, 2004, 8:48 am
Command line options: using an [option: parameter] without a parameter passed to it December 28, 2005, 6:56 am
use one line Perl command to add a line at the begin of a file December 13, 2005, 3:25 pm
Missing first line when reading in .csv file January 27, 2005, 8:51 pm
How to ignore 1st line in a file when reading June 28, 2006, 11:58 am
Re: Reading a line from a CVS file into an array. June 12, 2008, 2:49 pm
Re: Reading a line from a CVS file into an array. June 12, 2008, 2:52 pm
Re: Reading a line from a CVS file into an array. June 13, 2008, 11:23 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap