Line 1
Line 2
Line 3
Line 4
Line 5

should become

Line 5
Line 4
Line 3
Line 2
Line 1

I need a notepad script to do this.

link|improve this question
Notepad is not scriptable, is it? – grawity Dec 12 '11 at 18:32
feedback

5 Answers

If you have Perl installed you can use

perl -e 'print reverse <> ' filename > newfile

As in

$ cat file.txt
line 1
line 2
line 3
line 4
line 5
$ perl -e 'print reverse <>' file.txt > new.txt
$ cat new.txt
line 5
line 4
line 3
line 2
line 1

(its the same on Windows but use type instead of cat and use double-quotes (") in the perl command.)

You have tagged your question "notepad" and mentioned "notepad" in the text. If you want a solution using "notepad++", you should edit the question accordingly.

link|improve this answer
feedback

Notepad, unless you mean some other than the one that comes with Windows OS, is not scriptable. Were you to use Vim, it would be simply

:g/^/m0
link|improve this answer
feedback

This is a three step process in Notepad++ using TextFX.

  1. Select the entire document (ctrl+A) (or the section you want to be reversed), and from the TextFX menu, select TextFX Tools -> Insert Line Numbers.
  2. From the TextFX menu, make sure that TextFX Tools -> +Sort ascending is unchecked and then select TextFX Tools -> Sort lines case sensitive (at column). This will reverse the order of the lines.
  3. From the TextFX menu, select TextFX Tools -> Delete Line Numbers or First Word, and you're done.

The Notepad app that ships with Windows is pretty much useless. There are many alternatives, but I prefer Notepad++.

link|improve this answer
feedback

You could try tac which reverses line by line

tac filename
link|improve this answer
feedback

If you were after a ready made script, the script center has one contributed by the community (i.e. not written by Microsoft)

http://gallery.technet.microsoft.com/scriptcenter/55ba15dc-9933-4c9d-a2b0-524453a66343

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.