How to turn a file upside down?

How to turn a file upside down?

2
NewbieNewbie
2

    Dec 21, 2004#1

    Hello there,
    I am a newbie and I am trying to write a macro that will turn a text file upside down, i.e. the first row should be the last row etc., and save it with a different name. This task that I thought to be very trivial, cause me a lot of frustration.
    Thanks in advance for any help.

    206
    MasterMaster
    206

      Dec 22, 2004#2

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOn
      Top
      ColumnModeOn
      ColumnInsert " ~"
      Top
      ColumnInsertNum 1 1 
      Top
      SortDes Numeric 1 -1 0 0 0 0 0 0
      Top
      Find RegExp "^\d+ +~"
      Replace All ""
      ColumnModeOff
      SaveAs
      Software For Metalworking
      http://closetolerancesoftware.com

      2
      NewbieNewbie
      2

        Dec 23, 2004#3

        Thank you very much mrainey56.
        Neat solution!

        14
        Basic UserBasic User
        14

          Jun 08, 2006#4

          Can anyone tell me how to use mrainey56's reverse sort order macro on just selected lines?

          I have a situation where I need to reverse the order of just a portion of a file and haven't been able to have the macro operate on just a selected set of lines.

          Thanks!

          206
          MasterMaster
          206

            Jun 09, 2006#5

            Try this modified version:

            Code: Select all

            InsertMode
            ColumnModeOff
            HexOff
            UnixReOn
            IfSel
            Clipboard 1
            Cut 
            ToggleBookmark
            NewFile
            Paste 
            "
            "
            Top
            ColumnModeOn
            ColumnInsert " ~"
            Top
            ColumnInsertNum 1 1 
            Top
            SortDes Numeric 1 -1 0 0 0 0 0 0
            Top
            Find RegExp "^\d+ +~"
            Replace All ""
            ColumnModeOff
            SelectAll
            Cut 
            CloseFile NoSave
            GotoBookMark
            Paste 
            Delete
            GotoBookMark
            ToggleBookmark
            ClearClipboard
            Clipboard 0
            Else
            ExitMacro
            EndIf

              Jun 09, 2006#6

              This is better, I think. The other could fail if you already had bookmarks set when you ran it.

              Code: Select all

              InsertMode
              ColumnModeOff
              HexOff
              UnixReOn
              IfSel
              Clipboard 1
              Cut 
              "$@~*"
              NewFile
              Paste 
              "
              "
              Top
              ColumnModeOn
              ColumnInsert " ~"
              Top
              ColumnInsertNum 1 1 
              Top
              SortDes Numeric 1 -1 0 0 0 0 0 0
              Top
              Find RegExp "^\d+ +~"
              Replace All ""
              ColumnModeOff
              SelectAll
              Cut 
              CloseFile NoSave
              Find "$@~*"
              DeleteToStartofLine
              Paste 
              Delete
              Clipboard 0
              Else
              ExitMacro
              EndIf
              Software For Metalworking
              http://closetolerancesoftware.com