Simplifying line terminations for UNIX

General and specific configuration/INI settings

Simplifying line terminations for UNIX

Postby EricT » Fri Mar 09, 2012 10:43 pm

Hi All

I gave this a read here:

Weird behavior with unix REGEX

Tried a few different configurations and I fear that I am running around in circles.

Right now I'm saving documents from word, as text, and reopening in Ultraedit (latest version).

When I open them, they are in UNIX mode (which I like) but the line terminations are all a combination of \n and \r. I have a macro that deletes all \r, but as I edit if I hit the enter key a few times, I get more, have to remove again, etc.

Short version is - I want any and all text files opened to come in with \n as terminations ONLY and nothing else. How can I do this?

Thanks in advance for answering what is most likely a very basic question!
EricT
Newbie
 
Posts: 5
Joined: Thu Mar 08, 2012 8:22 pm

Re: Simplifying line terminations for UNIX

Postby Mofi » Sat Mar 10, 2012 3:40 pm

First, read UE symbol explanations for line teminators.

If you prefer Unix line terminators (linefeed only), you should select Unix at Advanced - Configuration - File Handling - DOS/Unix/Mac Handling as the default line terminator type for new files although on Windows computers DOS is usually used for text files.

In the same configuration dialog you should select also Never prompt to convert files to DOS format to keep text files with Unix line terminators without temporary or permanent conversion to DOS (carriage return + linefeed).

The other 2 settings with checkboxes should be not checked if you prefer Unix line terminators.

Further you should have the setting On paste convert line endings to destination type (Unix/Mac/DOS) enabled at Advanced - Configuration - File Handling - Conversions. That results in converting every CR, LF or CRLF on paste from other applications like MS Word to the line terminator type of the file which is Unix (LF) in your case. I suggest to use in MS Word Ctrl+A to select everything, Ctrl+C to copy to Windows clipboard, and paste with Ctrl+V the text into the file in UltraEdit.

After opening a text file in UltraEdit, take a look on the status bar at bottom of the UltraEdit window. If in third box DOS is displayed, right click on the file tab of the file and left click on Conversions - DOS to UNIX. Or you execute the command via File - Conversions - DOS to UNIX. The indication in the status bar changes to UNIX.

If the text copied from MS Word contains line breaks within paragraphs, you may want to remove them in the text file. I suggest to use in this case first Format - Trim Trailing Spaces and next Format - Convert CR/LFs to Wrap.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3936
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Simplifying line terminations for UNIX

Postby EricT » Sat Mar 10, 2012 5:17 pm

That was exactly what I needed. I had the unix setting checked, but also the "do not prompt and convert to dos" checked. Fixed that and presto! Very cool.

Mofi you sure do get around here! Thanks a ton for all the hard work you do helping people out and explaining things so well, it's very appreciated! :P
EricT
Newbie
 
Posts: 5
Joined: Thu Mar 08, 2012 8:22 pm


Return to Configuration/INI Settings