Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2508 > unrolled thread

writing Unix files on Windows

Started byRoedy Green <see_website@mindprod.com.invalid>
First post2013-02-18 07:45 -0800
Last post2013-02-24 03:53 -0800
Articles 7 — 5 participants

Back to article view | Back to comp.lang.java.help


Contents

  writing Unix files on Windows Roedy Green <see_website@mindprod.com.invalid> - 2013-02-18 07:45 -0800
    Re: writing Unix files on Windows Fred Kleinschmidt <fred.l.kleinschmidt@gmail.com> - 2013-02-18 07:51 -0800
      Re: writing Unix files on Windows Roedy Green <see_website@mindprod.com.invalid> - 2013-02-18 08:58 -0800
    Re: writing Unix files on Windows Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2013-02-20 13:28 -0800
      Re: writing Unix files on Windows "Steve W. Jackson" <stevewjackson@knology.net> - 2013-02-21 12:00 -0600
        Re: writing Unix files on Windows "John B. Matthews" <nospam@nospam.invalid> - 2013-02-22 00:01 -0500
        Re: writing Unix files on Windows Roedy Green <see_website@mindprod.com.invalid> - 2013-02-24 03:53 -0800

#2508 — writing Unix files on Windows

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-02-18 07:45 -0800
Subjectwriting Unix files on Windows
Message-ID<v0j4i8dgbatj22b0u6e2dpv90tg8jsdsqn@4ax.com>
On Windows, println uses \r\n line endings.

What is the canonical way to write files with \n line endings on
Windows?
-- 
Roedy Green Canadian Mind Products http://mindprod.com
The generation of random numbers is too important to be left to chance. 
~ Robert R. Coveyou (born: 1915 died: 1996-02-19 at age: 80)

[toc] | [next] | [standalone]


#2509

FromFred Kleinschmidt <fred.l.kleinschmidt@gmail.com>
Date2013-02-18 07:51 -0800
Message-ID<188d0eb8-0a18-4f90-98a3-634385322f80@googlegroups.com>
In reply to#2508
On Monday, February 18, 2013 7:45:49 AM UTC-8, Roedy Green wrote:
> On Windows, println uses \r\n line endings. What is the canonical way to write files with \n line endings on Windows? -- Roedy Green Canadian Mind Products http://mindprod.com The generation of random numbers is too important to be left to chance. ~ Robert R. Coveyou (born: 1915 died: 1996-02-19 at age: 80)

Look at system property line.separator

[toc] | [prev] | [next] | [standalone]


#2510

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-02-18 08:58 -0800
Message-ID<nan4i856ou1qti4sp4t190vja2vnc5eb8q@4ax.com>
In reply to#2509
On Mon, 18 Feb 2013 07:51:27 -0800 (PST), Fred Kleinschmidt
<fred.l.kleinschmidt@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>Look at system property line.separator

see http://mindprod.com/jgloss/lineseparator.html

The catch with setting it is Oracle says you should not.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
The generation of random numbers is too important to be left to chance. 
~ Robert R. Coveyou (born: 1915 died: 1996-02-19 at age: 80)

[toc] | [prev] | [next] | [standalone]


#2511

FromKnute Johnson <nospam@rabbitbrush.frazmtn.com>
Date2013-02-20 13:28 -0800
Message-ID<kg3f3q$ofi$1@dont-email.me>
In reply to#2508
On 2/18/2013 07:45, Roedy Green wrote:
> On Windows, println uses \r\n line endings.
>
> What is the canonical way to write files with \n line endings on
> Windows?
>
That is always a problem when moving a text file from Windows to Unix. 
There is a Unix utility for conversion, dos2unix and there might be the 
reverse I can't remember.

knute...

[toc] | [prev] | [next] | [standalone]


#2520

From"Steve W. Jackson" <stevewjackson@knology.net>
Date2013-02-21 12:00 -0600
Message-ID<stevewjackson-3E0B24.12005221022013@news.individual.net>
In reply to#2511
In article <kg3f3q$ofi$1@dont-email.me>,
 Knute Johnson <nospam@rabbitbrush.frazmtn.com> wrote:

> On 2/18/2013 07:45, Roedy Green wrote:
> > On Windows, println uses \r\n line endings.
> >
> > What is the canonical way to write files with \n line endings on
> > Windows?
> >
> That is always a problem when moving a text file from Windows to Unix. 
> There is a Unix utility for conversion, dos2unix and there might be the 
> reverse I can't remember.
> 
> knute...

On Unix systems, there will likely be both "dos2unix" and "unix2dos" 
utility programs available.
-- 
Steve W. Jackson
Montgomery, Alabama

[toc] | [prev] | [next] | [standalone]


#2527

From"John B. Matthews" <nospam@nospam.invalid>
Date2013-02-22 00:01 -0500
Message-ID<nospam-E52E8E.00010722022013@news.aioe.org>
In reply to#2520
In article <stevewjackson-3E0B24.12005221022013@news.individual.net>,
 "Steve W. Jackson" <stevewjackson@knology.net> wrote:

> In article <kg3f3q$ofi$1@dont-email.me>,
>  Knute Johnson <nospam@rabbitbrush.frazmtn.com> wrote:
> 
> > On 2/18/2013 07:45, Roedy Green wrote:
> > > On Windows, println uses \r\n line endings.
> > >
> > > What is the canonical way to write files with \n line endings on 
> > > Windows?
> > >
> > That is always a problem when moving a text file from Windows to 
> > Unix. There is a Unix utility for conversion, dos2unix and there 
> > might be the reverse I can't remember.
> 
> On Unix systems, there will likely be both "dos2unix" and "unix2dos" 
> utility programs available.

If not, tr is an alternative.

$ tr -d '\r' < dos.txt > new.txt

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#2540

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-02-24 03:53 -0800
Message-ID<blvji8tdup6ip5efut7m6c4b09qa8p6gil@4ax.com>
In reply to#2520
On Thu, 21 Feb 2013 12:00:52 -0600, "Steve W. Jackson"
<stevewjackson@knology.net> wrote, quoted or indirectly quoted someone
who said :

>On Unix systems, there will likely be both "dos2unix" and "unix2dos" 
>utility programs available.

It is a pretty easy utility to write.  I use Unix conventions on
Windows files whose ultimate destination is the web.  I though there
may be some elegant way to produce them directly.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
The generation of random numbers is too important to be left to chance. 
~ Robert R. Coveyou (born: 1915 died: 1996-02-19 at age: 80)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.help


csiph-web