Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[OT] add carriage return to text files

5 views
Skip to first unread message

dale

unread,
Feb 19, 2017, 5:41:51 PM2/19/17
to
I have a bunch of octave, gnuplot and awk files that I made in gedit on
linux, they only have a linefeed at the end of a line, I would like to
add a carriage return after each linefeed so I can see them on windows

any ideas? probably could do an awk file on each, that would save some time

want to do them in a batch all at once, guess I could do a bash script
of awk conversions

if someone has already done this, or knows how, would you point me in
the right direction?

tried to google some ...


--
dale | http://www.dalekelly.org

Kaz Kylheku

unread,
Feb 19, 2017, 6:54:08 PM2/19/17
to
On 2017-02-19, dale <da...@dalekelly.org> wrote:
> I have a bunch of octave, gnuplot and awk files that I made in gedit on
> linux, they only have a linefeed at the end of a line, I would like to
> add a carriage return after each linefeed so I can see them on windows

Learn real editor.

Vim:

:set fileformat=dos
:w

File now saved with CR-LF line endings. Next time you open the file,
Vim will automatically use this fileformat setting.

If you you are just simply using a shared folder between Linux and
Windows, or copying the files back and forth, consider just keeping the
files in Windows format. If Octave and Gnuplot on Linux don't mind
the CR's, you're just fine. Edit in a decent editor and you won't
see the line endings.

Regarding conversion, the manpage for "unix2dos" and "dos2unix".

Another thing: you should consider putting your files into a
cross-platform version control system like Git. A version control system
can create a working copy of text files in the local operating system
format.

You can make a change on Windows to your Octave or Awk code,
commit the change, then push it out to your Linux-side repository
where the update is seen in Unix format.

No software developer worth their salt performs conversions on
their maintained source code between Unix and Windows. Version
control takes care of it.

I wouldn't develop anything other than throwaway code without version
control.

Karl Ratzsch

unread,
Feb 20, 2017, 3:03:42 AM2/20/17
to
Am 19.02.2017 um 23:41 schrieb dale:
> I have a bunch of octave, gnuplot and awk files that I made in gedit on
> linux, they only have a linefeed at the end of a line, I would like to
> add a carriage return after each linefeed so I can see them on windows
>
> any ideas? probably could do an awk file on each, that would save some time
>
> want to do them in a batch all at once, guess I could do a bash script
> of awk conversions



Just don't use the horrible built-in "notepad.exe" editor on windows,
but one of the much better configurable alternatives.

Kenny McCormack

unread,
Feb 20, 2017, 3:29:13 AM2/20/17
to
This is good advice. For the most part, there's no real problem with just
leaving the files as they are (i.e., in Unix/Linux format). Most Windows
programs will work OK. It is just that the default editor - the one people
intuitively recommend for newbies, even though they'd never actually use it
themselves - is brain dead about this.

The simplest alternative is "Wordpad", which is installed by default in
Windows (no special install or configuration needed) and has no problem
displaying files w/o CRs.

But, yeah, I get caught by this every once in a while - bringing up a Unix
file in Notepad and going Arrrrghhhh!

--

First of all, I do not appreciate your playing stupid here at all.

- Thomas 'PointedEars' Lahn -

dale

unread,
Feb 20, 2017, 12:02:53 PM2/20/17
to
for some reason they need the carriage returns in a <div> code block in
HTML on Edge or Internet Explorer, I don't currently have an example to
show, but will be back, might be a CSS configuration for <div>

--
dale | http://www.dalekelly.org

dale

unread,
Mar 4, 2017, 12:01:09 PM3/4/17
to
On 2/19/17 7:15 PM, dale wrote:
> Thanks Much!!!
> be back when I give it a try
>

signed up for github, when I download a text file it still doesn't work
in notepad, but it works in wordpad

guess it is a notepad problem

--
dale | http://www.dalekelly.org
0 new messages