Discussion:
writing Unix files on Windows
(too old to reply)
Roedy Green
2013-02-18 15:45:49 UTC
Permalink
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)
Fred Kleinschmidt
2013-02-18 15:51:27 UTC
Permalink
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
Roedy Green
2013-02-18 16:58:42 UTC
Permalink
On Mon, 18 Feb 2013 07:51:27 -0800 (PST), Fred Kleinschmidt
Post by Fred Kleinschmidt
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)
Knute Johnson
2013-02-20 21:28:27 UTC
Permalink
Post by Roedy Green
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...
Steve W. Jackson
2013-02-21 18:00:52 UTC
Permalink
Post by Knute Johnson
Post by Roedy Green
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
John B. Matthews
2013-02-22 05:01:07 UTC
Permalink
Post by Steve W. Jackson
Post by Knute Johnson
Post by Roedy Green
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>
Roedy Green
2013-02-24 11:53:14 UTC
Permalink
On Thu, 21 Feb 2013 12:00:52 -0600, "Steve W. Jackson"
Post by Steve W. Jackson
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)
Loading...