Click here to get back home

split by word using | as delimiter

 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
split by word using | as delimiter William 12-20-2005
Get Chitika Premium
Posted by William on December 20, 2005, 5:02 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
Split, variable delimiter February 21, 2006, 1:11 pm
Which split delimiter to use for mailbox March 13, 2008, 4:41 am
Using RE's to match a word split across lines? September 14, 2004, 8:25 pm
How to extract part of the text (htm) file after start word until end word? May 12, 2006, 5:32 am
Parsing a file with a known delimiter November 11, 2005, 7:29 pm
Calculations with ',' as decimal delimiter March 23, 2006, 3:21 pm
parsing a tab delimited or CSV, but keep the delimiter March 22, 2007, 4:04 pm
parse with multiple delimiter April 25, 2007, 3:40 pm
Matching escaped delimiter chars November 28, 2005, 9:21 pm
Processing multiple delimiter files March 13, 2006, 4:47 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap