Click here to get back home

Getting Text Value , in Single line

 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
Getting Text Value , in Single line George Kinley 07-27-2004
Posted by Tony Muler on August 2, 2004, 10:40 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
Formatting a single line without effecting the entire table with the Text::Table module March 10, 2005, 11:18 am
Command Line single execution of a line(s) of code April 15, 2005, 4:28 am
Single-liner for one-line substitute? June 28, 2006, 5:38 am
Omitting data from a single line.. November 27, 2007, 12:36 am
Can (nearly) any Perl program be written on a single line? October 19, 2005, 5:30 pm
I want to output all of my STDOUT to a single line....dont want to scroll September 11, 2006, 3:37 pm
Parsing a text file line-by-line: skipping badly-formed lines? May 14, 2007, 11:10 am
Loop through a text file line by line January 12, 2005, 7:32 pm
Backticks with single quote inside single quotes April 15, 2006, 5:56 pm
Tk::Checkbutton - text does not line up ... September 10, 2006, 4:25 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap