How do I replace multiple lines

How do I replace multiple lines

2
NewbieNewbie
2

    Jul 28, 2004#1

    Hi

    We have a machine that outputs files like

    **StartProcess0
    121231
    123123
    123
    123
    13
    12312
    123123
    **End
    **StartProcess1
    etc

    The data between StartProcess0 and **End has a variable number of lines.

    So in some files there are say 2 lines between StartProcess0 and **End and other between 10-15

    How can one select this random size paragraph between StartProcess0 and **End ?

    Tried stuff like StartProcess0 * ^p* End to no avail.
    Thanks
    JB

    206
    MasterMaster
    206

      Jul 28, 2004#2

      Here's one approach, using the contents of a template as the replace string and @@@ as dummy strings to mark the beginning and end of the text to replace. Could easily be put into a loop for multiple replacements (second example, not tested).

      Or, you could just manually select the lines and insert a template, which would overwrite the selected text..




      InsertMode
      ColumnModeOff
      HexOff
      TrimTrailingSpaces
      Find "StartProcess1"
      Key HOME
      Key DOWN ARROW
      "@@@"
      Key DOWN ARROW
      Key HOME
      Find "**End"
      Key UP ARROW
      Key END
      "@@@"
      Key HOME
      Find Up "@@@"
      Find Select "@@@"
      Template 0


      InsertMode
      ColumnModeOff
      HexOff
      TrimTrailingSpaces
      Loop
      Find "StartProcess1"
      IfNotFound
      ExitLoop
      EndIf
      Key HOME
      Key DOWN ARROW
      "@@@"
      Key DOWN ARROW
      Key HOME
      Find "**End"
      Key UP ARROW
      Key END
      "@@@"
      Key HOME
      Find Up "@@@"
      Find Select "@@@"
      Template 0
      EndLoop

      2
      NewbieNewbie
      2

        Jul 29, 2004#3

        Hi

        Thank you very much for that solution. It worked great.

        I opened all the files (some 50) and ran the macro - edited to save and close after run - so it simply ran on 50 opened files.

        Do you know of a way to run it on an amount of files without having to open them all at once i.e. processing them indivudually?


        Best regards,
        JB