Click here to get back home

Search a text file ,picking values from array

 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
Search a text file ,picking values from array sandi_siva 03-05-2007
Get Chitika Premium
Posted by sandi_siva on March 5, 2007, 4:15 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
Using an array to search a text file May 8, 2007, 9:14 am
search/replace values from an array... August 1, 2004, 7:29 pm
search/replace values from an array - Part 2. August 2, 2004, 12:33 pm
Picking Element from Array one by one November 30, 2005, 7:14 am
Search/Replace text in XML file January 9, 2008, 2:21 pm
Search regular expression with search for hex values in files? January 6, 2008, 7:19 am
Trouble with parsing text file and grabbing values needed July 21, 2006, 1:18 pm
Search a Text File for a String, Return String to Function July 29, 2006, 12:19 pm
Parsing a text file into an array August 16, 2004, 11:12 am
from text file to array in shortest way November 7, 2005, 11:40 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap