On Tue, Apr 09, 2002 at 04:14:25AM -0500, Elizabeth Barham wrote:
> Kerstin Hoef-Emden <[EMAIL PROTECTED]> writes:
> > Are similar tools to flip and dos2unix available for converting
> > Mac-ASCII texts?
> 
> perl works well.
> 
> perl -i -pe 's/\r/\n/g' [filename...]
> 
> the -i means to edit the files in place. See perl --help for more
> information on it.

mac files use '\015' for end-of-line, whereas pc files use
'\015\012'. (and in macperl, \n == \015, by the way, instead of
everyone else's \012.)

-- 
I use Debian/GNU Linux version 2.2;
Linux server 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 i586 unknown
 
DEBIAN NEWBIE TIP #56 from Vineet Kumar <[EMAIL PROTECTED]>
:
Troubled by DOS-FORMAT OR MAC-FORMAT TEXT FILES? Here's another
way to deal with those troublesome ^M characters: a simple
        tr -d '\015'  < dos.file  > reg.file
should do the trick.  While we're on the subject, a Mac file
can be converted with
        tr '\015' '\012'  < mac.file  > reg.file
You can do all your CR/LF translations with tr as long as you
can remember that macs use CRs, *nices use LFs, and DOS uses
CR+LF.

Also see http://newbieDoc.sourceForge.net/ ...


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to