Tuesday, May 3, 2011

Sorting lines in Notepad++

In Excel 2003 for sorting the rows using the desired column use Data/Sort option. However, you may end up with a problem of being able to sort only files with less then 65,536 rows in Excel 2003. Newer versions of Excel and OpenOffice have the extended limit of 1,048,576 rows. Even in that case you may want to analyze bigger files with more than 1,048,576 rows.

One possible way to sort according to the first column:
Install Notepad++, http://notepad-plus-plus.org/
Click Plugins/Plugin Manager/Show Plugin Manager

Under Available find TextFx Characters
Click Install
Selext rows to be sorted.
Click TextFx/TextFx Tools
Check or uncheck Sort ascending
Click Sort lines case sensitive or Sort lines case insensitive



19 comments:

  1. This Tip is not only related to excel, I like to sort my include lines in C :)

    Thank You!

    ReplyDelete
  2. Thanks for sharing..!! I love your post .. I am looking more post like this one on
    this blog .. this post proves really helpful for me .
    Free softwares

    ReplyDelete
  3. SynWrite editor has more powerfull "Sort lines" dialog. PSPad too, almost the same as in Synw.

    ReplyDelete
  4. Google found this blog post for me and I was able to sort now. Thanks!

    ReplyDelete
  5. But how to just reverse text line list?
    I not mean by alphabetically, just reverse lines, write last line first, first last and in exapmle second line from bottom as second line from top?

    ReplyDelete
  6. Ok, I realised how:

    Edit > Select All
    TextFX > TextFX Tools > Insert Line Numbers If TextFX > TextFX Tools > +Sort ascending is checked, uncheck it
    TextFX > TextFX Tools > Sort lines case sensitive (at column)
    TextFX > TextFX Tools > Delete Line Numbers or First Word

    ReplyDelete
  7. I didn't have the TextFx Characters plugin for Notepad++, but there is a "Column sorting" plugin that did the trick.

    ReplyDelete
    Replies
    1. Never mind, TextFx was already installed, I was looking in the wrong menu. (Column sorting does work too though.)

      Delete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hi, does anyone know if I can sort at the second (or higher) column with TextFX? I can't seem to do it.

    ReplyDelete
  10. I encountered a problem in sorting:

    A column of numbers 100,120,20 is sorted as:
    100
    120
    20

    Any solution to that?

    ReplyDelete
    Replies
    1. You can apply some regex search and replace to add leading zeros to the two digit numbers:
      FIND: (^[0-9]{2}$)
      REPLACE: 0\1
      Then apply the sort
      then kill off the zeros you added:
      SEARCH: (^0([0-9]{2}$))
      REPLACE: \2
      Hope that helps

      Delete