My first macro,, Help,, (thanks)

My first macro,, Help,, (thanks)

10
Basic UserBasic User
10

    Jun 16, 2005#1

    Hi all,

    I'm new to Macros,, so forgive me if my question has
    been covered here already a dozen times. I've tried
    using the "Record" function, and setting up an application,
    but it seems there's something I'm missing.

    I'm working with large text files from a discussion list
    archive, weekly digests and such and each one with
    hundreds of posts, and thousands of lines.

    What I'm trying to do is delete some of the header and
    routing info, usually about 20 lines, but it's not consistent.


    Here's an example, of the section I'd like to edit/delete.

    From: "Return-Path:" including that line,,

    To: "Message-ID:" including that line.

    The only thing consistent in the data would be those two
    things. Return-Path & Message-ID. Everything in between
    would usually be different and I'd like to have removed.

    Thanks,
    Ron

    -- End --

    ==> Return-Path: <[email protected]>
    Delivered-To: [email protected]
    Received: from almond.ease.lsoft.com (almond.ease.lsoft.com [209.119.0.160])
    by server1.safepages.com (Postfix) with ESMTP id B70A060FA
    for <read@nnnmnmn>; Mon, 21 Jan 2002 08:31:25 +0000 (GMT)
    Received: from home (maillist.abusenet.org) by almond.ease.lsoft.com (LSMTP for Windows NT v1.1b) with SMTP id <[email protected]>; Mon, 21 Jan 2002 3:31:26 -0500
    Received: from HOME.EASE.LSOFT.COM by HOME.EASE.LSOFT.COM (LISTSERV-TCP/IP
    release 1.8e) with spool id 69424875 for
    [email protected]; Mon, 21 Jan 2002 03:31:26 -0500
    Received: from imo-m04.mx.aol.com by home.ease.lsoft.com (LSMTP for Windows NT
    v1.1b) with SMTP id <[email protected]>; Mon, 21 Jan
    2002 3:31:25 -0500
    Received: from [email protected] by imo-m04.mx.aol.com (mail_out_v31_r1.25.) id
    5.36.21efb0fe (15863) for <[email protected]>; Mon,
    21 Jan 2002 03:31:20 -0500 (EST)
    Received: from web38.aolmail.aol.com (web38.aolmail.aol.com [205.188.222.14])
    by air-id06.mx.aol.com (v82.22) with ESMTP id MAILINID62-0121033120;
    Mon, 21 Jan 2002 03:31:20 1900
    Mime-Version: 1.0
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: 7bit
    X-Mailer: Unknown (No Version)
    ==>> Message-ID: <[email protected]>


    Date: Mon, 21 Jan 2002 03:31:20 EST
    Reply-To: [email protected]>
    Sender: Faithful <[email protected]>
    From: "Mark" <[email protected]>
    Subject: Re: [LI] Sample Post

    6,675585
    Grand MasterGrand Master
    6,675585

      Jun 16, 2005#2

      No problem for me. If you don't want the deletion of the characters from beginning of the line to Return-Path: and the characters + linebreak after Message-ID: delete the red highlighted characters of the macro code.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Loop
      Find RegExp "%*Return-Path:"
      IfFound
      StartSelect
      Find RegExp Select "Message-ID:*^p"
      IfFound
      EndSelect
      Delete
      Else
      ExitLoop
      EndIf
      Else
      ExitLoop
      EndIf
      EndLoop
      Best regards from an UC/UE/UES for Windows user from Austria

      10
      Basic UserBasic User
      10

        Jun 16, 2005#3

        Thanks Mofi, :D

        Yes, what I want deleted is "Return-Path:" (and everything on that line)

        and everything up to:

        "Message-ID:" (and everything on that line,, )

        I'll give it a try on a test file.

        Thanks again,
        Ron

          Jun 16, 2005#4

          Wow, now THAT was slick. It saves me truckloads of time.

          It's a tedious job otherwise.

          Thanks,
          Ron

            Jun 18, 2005#5

            Can someone point me to a good tutorial for writing
            and understanding Macros (for Dummies)?

            I appreciate Mofi for writing one for me, but it's
            probably better to learn the trade too, right? ;-)

            My next thing on my clip-fest is this,,

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            Date: Mon, 15 Apr 2002 20:04:52 -0400
            Reply-To: lighthouse_ [email protected]>
            Sender: [email protected]>
            From: Edwin XXXXX <[email protected]>
            Subject: Re: [LI] Sample Subject Line,,,
            To: [email protected]
            X-PMFLAGS: 33554560 0 1 P0A5F0.CNM

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            I want to reduce it to this:

            Date: Mon, 15 Apr 2002 20:04:52 -0400
            From: Edwin XXXXX <[email protected]>
            Subject: Re: [LI] Liberation of the woods / was 22:22:22,2,2,2002's


            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            Basically I want to just keep the Date, From & Subject
            fields, and remove everything else from the header,
            and process the entire file. Usually around 2-3000 lines.

            Removing,, the *lines* "Reply-To:"
            "Sender:"
            "To:"
            "X-PMFLAGS:"

            Ron

              Jun 18, 2005#6

              PS: Also,, If I study a tutorial for Macros in Word, or Excel,
              will it apply here too? Is it proprietary and specific to the
              software, or more general and widely accepted code,,
              like html?

              Thanks,
              Ron

              tatwo
              tatwo

                Jun 18, 2005#7

                Products like UltraEdit, MS Word, MS Excel handle macros in their own ways ..

                If you are looking for a generic process which works across different products try AutoHotKey.

                Another nice generic text parsing tool is TEXTools.

                Both of these tools can be used to create scripts which can be opened within UltraEdit .. e.g. you can build pipes or text filters to process text.

                And you can call them from UltraEdit (or MS Word) built macros.

                10
                Basic UserBasic User
                10

                  Jun 18, 2005#8

                  dragonfly wrote:Products like UltraEdit, MS Word, MS Excel handle macros in their own ways ..
                  Then I'd be more interested in a UltraEdit-Specific tutorial.
                  I just don't see it here yet,,

                  I like some of the features I see here so I'd like to do all
                  that I need in just one program.

                  My application is pretty simple. I just want to take expanded
                  email headers in archive files, and reduce them down to the
                  basics,, Date, Author, Subjet,, List Name.

                  Some of my test Macros have taken too much off the header,
                  and I don't know why. So I'm not going to perform real
                  surgery on my files until I'm confident in the program, and in
                  my understanding of it.

                  Ron

                  tatwo
                  tatwo

                    Jun 18, 2005#9

                    Obvious question - have you read Help - in particular Macro Menu

                    all the macro commands are listed there .. you can amend Mofi's basic macro suggested above if you understand the commands.

                    My own preference is to use Unix syntax regexp .. not the UltraEdit syntax .. then you can study (Unix) regexp in different sources on the Internet.

                    If you stick with Unix syntax this utility will help you to test your regexp on test files before you build them into macros.

                    Regex coach

                    Also tick the box

                    Unix Style Reg Exp

                    in Advanced > Configuration > File

                    ...

                    If you read Mofi's macro (and you decide to opt for Unix syntax) change the command ...

                    UnixReOff

                    to

                    UnixReOn