Loading ...
Sorry, an error occurred while loading the content.

12054Re: [NTB] Modify Lines - Reverse?

Expand Messages
  • Harvey R. Savage
    Oct 1, 2001
      otirsh@... wrote:
      > Hi,
      > Help? How do I reverse the order of lines of a text document in
      > notetab ?
      > i.e.
      > transform this:
      > apples
      > peaches
      > plums
      > into this:
      > plums
      > peaches
      > apples
      > Great program.
      > Like the new clip bar that I found in my most recent update.
      > Trish

      Hi Trish,

      I think this clip is what you wanted. It reverses the order of
      lines in a file without a descending sort.

      Add clip to a library of your choice, load the file you want to
      reverse and run the clip.

      It is written to create a new file, with the lines reversed,
      without altering the parent file.

      Word wrap is turned off in case you have any long lines.

      Toward the end of the clip, before the AppendTofile line, 2
      instruction lines tell how to preserve, or not, blank lines.

      Take care that the Append line doesn't get wrapped after you add
      the clip to a library.

      h="reverse line order"
      ^!SetWordWrap OFF
      ^!Set %linecount%=^$GetTextLineCount$
      ^!Set %index%=^$GetTextLineCount$
      ^!If ^%index% = 0 END
      ^!Jump ^%index%
      ^!IfError END
      ^!Select Line
      ^!SetClipboard ^$GetSelection$
      ^!Dec %index%
      ;- to remove blank lines from finished file
      ;- remove comment/; from next line
      ;^!If ^$GetSelection$ = "" LOOP
      ^!AppendToFile "^$GetDocumentPath$reverse_line_order.txt"
      ^!Goto LOOP
      ^!Open ^$GetDocumentPath$reverse_line_order.txt
      ^!SetWordWrap On

    • Show all 4 messages in this topic