Flip or reverse line order in Notepad++

Solution not requiring other software except normally-included TextFX plugin:

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

This can also be done in Notepad++ without the TextFX plugin. It follows the same strategy of that of the accepted answer, but using native functionality. It is done as follows:

  1. Edit > Select All
  2. Edit > Column Editor... > Select Number to Insert > Set Initial number to 1 > Set Increase by to 1 > Check Leading zeros > Click OK

enter image description here

  1. Edit > Line Operations > Sort Lines in Descending Order Edit: A recent update added extra sorting options, the option: Sort Lines Lexicographically Descending seems to do the job.

enter image description here

  1. Remove Line Numbers through either box selection (Alt+Left Click Drag or Alt+Shift Select) or Search/Replace

enter image description here


Well, since we are giving code examples, If you are on Windows 7 or you have installed PowerShell on another version of Windows, then:

$foo = New-Object System.collections.arraylist;
$foo.AddRange($(Get-Content 'C:\Path\To\File.txt));
$foo.Reverse();
$foo | Out-File C:\Path\To\File.txt

Or for a non-coding answer, download gVim, open the file and type:

:g/^/m0

Tags:

Notepad++