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

Re: [NTB] Modify Lines - Reverse?

Expand Messages
  • Harvey R. Savage
    ... 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,
    Message 1 of 4 , Oct 1, 2001
    • 0 Attachment
      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$
      :LOOP
      ^!If ^%index% = 0 END
      ^!Jump ^%index%
      ^!IfError END
      ^!Select Line
      ^!SetClipboard ^$GetSelection$
      ;^!DeleteLine
      ^!Dec %index%
      ;- to remove blank lines from finished file
      ;- remove comment/; from next line
      ;^!If ^$GetSelection$ = "" LOOP
      ^!AppendToFile "^$GetDocumentPath$reverse_line_order.txt"
      ^$GetClipboard$
      ;
      ^!Goto LOOP
      :END
      ^!Open ^$GetDocumentPath$reverse_line_order.txt
      ^!SetWordWrap On


      hrs
    Your message has been successfully submitted and would be delivered to recipients shortly.