Click here to get back home

Wierd issue with File::Find and directory

 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
Wierd issue with File::Find and directory rishid@gmail.com 05-12-2005
Posted by rishid@gmail.com on May 12, 2005, 7:35 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 rishid@gmail.com on May 12, 2005, 8:48 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 Jürgen Exner on May 13, 2005, 2:33 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
File::Find doesn't go down thru directory December 13, 2007, 5:27 pm
Recursive directory read with File::Find April 22, 2008, 6:43 pm
Using File::Find and only manipulating 1 file per directory. December 16, 2005, 10:53 am
File::Find dies on directory paths which are too long March 13, 2007, 2:53 pm
Invalid top directory at d:\perl\lib\file\find.pm line 562 September 27, 2007, 5:02 am
Find number of sub directories within a directory May 11, 2005, 8:39 am
Can't get perl to find .pm in my own private directory February 4, 2005, 3:06 pm
How to find all files in a directory with a specific mtime July 27, 2006, 6:39 am
INTERNAL SERVER ERROR (WIERD???) August 31, 2005, 5:16 am
To find a quick way to list all files in the directory(and subdirectory) April 21, 2008, 3:46 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap