[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: "decent" editors (was: line ending summary: the "Breg Hudther ton Proposal")

From: Michael Wood <mwood_at_its.uct.ac.za>
Date: 2001-12-18 11:51:30 CET

On Fri, Dec 14, 2001 at 11:33:42AM -0600, Edward S. Marshall wrote:
> On Thu, Dec 13, 2001 at 03:05:39PM -0800, Greg Stein wrote:
> > I don't know the name of the program on my linux box to do newline
> > conversions. I don't know how to execute it. Yes, I could dig around
> > (somebody mentioned "dos2unix", maybe that is a lead). And are there similar
> > tools available to me on Windows?
>
> Just for giggles, here's a handy set of convertions for people who deal with
> this stuff regularly:
>
> dos->unix: tr -d '\015'
> dos->mac: tr -d '\012'
> unix->dos: tr '\012' '\015\012'

Nope. This last one is equivalent to: tr '\012' '\015'

$ echo -en "test\nblah\n" >unix.txt
$ hexdump -c unix.txt
0000000 t e s t \n b l a h \n
000000a
$ tr '\012' '\015\012' <unix.txt >dos.txt.txt
$ hexdump -c dos.txt.txt
0000000 t e s t \r b l a h \r
000000a

> unix->mac: tr '\012' '\015'
> mac->unix: tr '\015' '\012'
> mac->dos: tr '\015' '\015\012'

Nope :) See the unix->dos comment.

You can use perl for this, though:

$ perl -pe 's/\n/\r\n/' <unix.txt | hexdump -c
0000000 t e s t \r \n b l a h \r \n
000000c

-- 
Michael Wood <mwood@its.uct.ac.za>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:53 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.