Saving file with line numbers displayed.

Saving file with line numbers displayed.

1
NewbieNewbie
1

    Jul 25, 2006#1

    The company I work for is using version 10.10. Is it possible to save a file with line numbers displayed? I looked through help and on the menu, but the only "line numbers" reference I can find is just for displaying them when the file is open. I need them actually in the file, so any editor, or webpage, will display them. I know version 12 will, but I don't know how soon I can get the company to upgrade.
    Thanks.

    6,675585
    Grand MasterGrand Master
    6,675585

      Jul 26, 2006#2

      Version 12 will also not save the line numbers. You have to insert the line numbers by ourself into the file. But this is very easy.

      Set the cursor to top of the file. Press Alt+C to switch to Column Mode.

      Use now Column - Insert/Fill Columns enter a space and execute it to insert a space at start of every line. You can also enter a different delimiter string, for example ": ".

      Well, now you have the delimiter string between the missing line numbers and the real start of the line.
      Note: Inserting the delimiter string could be also done with an appropriate regular expression search and replace all. But this method always works!

      Next click on Insert Number in menu Column. The defaults (first 1, increment 1, leading zeros, decimal) are perfect for your need. Click OK.

      Now your file has line numbers at start of every line with a delimiter string between line number and real start of the line.

      Turn off the column mode now by pressing again Alt+C and move the cursor with Ctrl+End to end of the file. The inserted number at end of the file below the last line should be also deleted. You can do this with Edit - Delete - Delete to Start of Line.

      Use Format - Trim Trailing Spaces and finally save the file.

      If you need this often, record it into a macro.

      I have recorded the described procedure above and here is the macro code, a little bit modified after recording. The red string is the delimiter string between the line number and the start of the line - here a single space.

      InsertMode
      ColumnModeOff
      HexOff
      Bottom
      IfColNum 1
      Else
      "
      "
      EndIf
      Top
      ColumnModeOn
      ColumnInsert " "
      ColumnInsertNum 1 1 LeadingZero
      ColumnModeOff
      Bottom
      DeleteToStartofLine
      Top
      Best regards from an UC/UE/UES for Windows user from Austria