Click here to get back home

splitting a mail log file

 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
splitting a mail log file eight02645999 06-27-2005
Get Chitika Premium
Posted by eight02645999 on June 27, 2005, 9:11 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 John Bokma on June 28, 2005, 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
splitting stderr/stdout without using file April 27, 2006, 7:22 am
Problem splitting lines from file input January 12, 2005, 12:14 pm
Mail queue and file locking December 4, 2004, 4:30 am
Read mail file? (Linux) December 14, 2004, 11:04 am
Mail contents of text file April 21, 2007, 10:26 pm
Mail file on typical Linux install? December 26, 2005, 10:56 am
Re: How to pipe text or load a file directly into mail-mode? May 4, 2006, 6:49 am
Using Mail::IMAPClient and Mail::Folder together June 2, 2005, 9:57 pm
Sending mail through Mail::Outlook May 25, 2006, 12:22 pm
splitting data? November 16, 2004, 1:00 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap