Flip or reverse line order in Notepad++
Solution not requiring other software except normally-included TextFX plugin:
- 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
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:
- Edit > Select All
- Edit > Column Editor... > Select Number to Insert > Set Initial number to 1 > Set Increase by to 1 > Check Leading zeros > Click OK
- 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.
- Remove Line Numbers through either box selection (Alt+Left Click Drag or Alt+Shift Select) or Search/Replace
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