Click here to get back home

Script to find unique words in a document

 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
Script to find unique words in a document Mike 07-26-2006
Get Chitika Premium
Posted by Mike on July 26, 2006, 4:00 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 axel on July 26, 2006, 4:01 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
find number of occurence for each unique values October 14, 2004, 4:26 pm
Help: String search in Windows 2000 doesn't find text in WindowsXP: MS Word document November 27, 2005, 9:13 am
How to give (put to browser) someone PDF document, with hidden path to document. December 20, 2005, 12:22 pm
Script that gives instance count unique patterns in a sorted file May 4, 2006, 2:36 pm
any pointers please? combine words script July 31, 2004, 1:31 pm
replace some words in a file with a perl script. December 12, 2004, 6:15 pm
Email script separates words with + instead of a space November 27, 2004, 7:51 am
A script to flag commonly misused words July 31, 2007, 6:35 pm
count lines,words,punctuations and characters in perl script November 11, 2006, 9:50 am
can the script find itself? April 6, 2008, 11:53 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap