Split a file and save split parts as file and open them byUE

Split a file and save split parts as file and open them byUE

4
NewbieNewbie
4

    Oct 19, 2005#1

    In other words I need to copy from .PROGRAM to .END of each routine and save every split routine in a file (with ".pg" as extension) with the same name of routine (path of file: same of that souce file)
    Immediately after I need to open those file by UE

    1) example of souce file :

    .PROGRAM routine_1()
    ...here is body of this routine
    .END
    .PROGRAM routine_100()
    ...here is body of this routine
    .END

    2) files generated and opened by UE macro :

    routine_1.pg
    routine_100.pg

    6,686585
    Grand MasterGrand Master
    6,686585

      Re: Split a file and save split parts as file and open them

      Oct 19, 2005#2

      Here is what you need. Look into the macro code and try to understand it. Make sure you have the source file open and active before starting the macro.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Clipboard 9
      CopyFilePath
      NewFile
      Paste
      Find Up "\"
      EndSelect
      Key RIGHT ARROW
      Key LEFT ARROW
      DeleteToEndofLine
      SelectAll
      Copy
      CloseFile NoSave
      Clipboard 8
      Top
      Loop
      Find ".PROGRAM"
      IfNotFound
      ExitLoop
      EndIf
      StartSelect
      Find Select ".END"
      Copy
      EndSelect
      Key HOME
      NewFile
      Paste
      Top
      Find RegExp ".PROGRAM[ ^t]+"
      EndSelect
      Key LEFT ARROW
      Key RIGHT ARROW
      StartSelect
      Find Select "("
      Key LEFT ARROW
      Copy
      EndSelect
      Top
      Clipboard 9
      Paste
      Clipboard 8
      Paste
      ".pg"
      SelectToTop
      Cut
      SaveAs "^c"
      NextWindow
      EndLoop
      ClearClipboard
      Clipboard 9
      ClearClipboard
      Clipboard 0
      Top
      UnixReOn

      Remove the last red command, if you use regular expression in UltraEdit style by default instead of Unix style - see Advanced - Configuration - Find - Unix style Regular Expressions. UnixReOn/UnixReOff modifies this setting.
      Best regards from an UC/UE/UES for Windows user from Austria

      2
      NewbieNewbie
      2

        Re: Split a file and save split parts as file and open them

        Dec 05, 2005#3

        I was wondering if there was a way to use the Advanced Sorting options to specify a column as a control-break column, and split a file by changes in a key-field.

        That would be an awesome feature/method for breaking data files up.