Click here to get back home

extracting text content from web page

 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
extracting text content from web page kjhjhjhjadsasda 09-28-2005
Posted by kjhjhjhjadsasda on September 28, 2005, 1:06 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

Posted by Dr.Ruud on September 29, 2005, 1: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

Similar ThreadsPosted
Extracting HTML Content April 30, 2006, 11:04 pm
reading web page content April 28, 2006, 9:04 pm
displaying different content types in same page January 27, 2006, 5:48 am
Extracting data from a password protected Web Page April 27, 2005, 5:34 am
How to extract all link from web page (loaded in variable $content) to scalar @links? September 11, 2006, 4:47 am
Extracting all img tag and surrounding text August 7, 2004, 10:39 am
Extracting the link text April 28, 2005, 1:04 am
extracting strings from a text file September 30, 2008, 8:52 am
Extracting text between two market lines. (FAQ variation?) April 13, 2007, 6:43 am
Extract content from a HTML or text file November 1, 2006, 11:59 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap