Simplifying line breaks/endings/terminations for UNIX

Simplifying line breaks/endings/terminations for UNIX

10
Basic UserBasic User
10

    Mar 10, 2012#1

    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!

    6,602548
    Grand MasterGrand Master
    6,602548

      Mar 10, 2012#2

      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.

      10
      Basic UserBasic User
      10

        Mar 10, 2012#3

        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