Find and replace if 2 matching search objects

Find and replace if 2 matching search objects

4
NewbieNewbie
4

    Nov 09, 2005#1

    Hello i see alot of tricky thing you can do with ultraedit

    But i have a problem....

    I need to delete a url some refer to another url,
    so what i dit have in my mind, is if i can sellect
    the start of the url (http://) and end on (&url=)
    so if i can make a replace search with the 2 keywords

    http:// if this line end on url= then delete the line from http to &url=

    Example

    http://microsoft.com&url=http://www.tucows.com

    The Bold tekst must be deleted and not the http://www.tucows.com
    still be untouched

    Example 2

    Before Cleaning

    http://dfgdfg.com&url=http://www.tucows.com
    http://micdfgdf.com&url=http://www.231231.com
    http://mifgfgf.com&url=http://www.dfgdfgdfg.com
    http://micfgfgf.com&url=http://www.tdfgdfgws.com
    http://micrfgfgfoft.com&url=http://www.tudfgdfgdfgs.com
    http://fgdddfgdfg.com&url=http://www.tdfgdfgdfgws.com

    After Cleaning looks like this

    http://www.tucows.com
    http://www.231231.com
    http://www.dfgdfgdfg.com
    http://www.tdfgdfgws.com
    http://www.tudfgdfgdfgs.com
    http://www.tdfgdfgdfgws.com

    I think you get the point... :D

    If you can help me out with my small problem, then you
    will save my as... for alot of "find line delete line and next,next,next"

    Hope there are a wize lady or man the can help me out with that
    And THX for read my prayers :cry:

    Best Regards
    Casper Rasmussen

    344
    MasterMaster
    344

      Nov 09, 2005#2

      Hi Casper,

      Am I going right that you want to look for "http : //" and take the address there and this should be the new line content ?

      so take my macro. Use another loop if you do it for every line (no need to press play several times then ...)

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOn
      Clipboard 9
      Find  "http://"
      IfFound
      Key RIGHT ARROW
      Key LEFT ARROW
      Find RegExp Select "($|[ ])"
      IfFound
      Cut 
      DeleteToStartofLine
      DeleteToEndofLine
      Paste 
      EndIf
      Key DOWN ARROW
      Key HOME
      EndIf
      Clipboard 0
      
      test it with this:
      dfgdfg.com&url=http://dict.leo.org
      micdfgdf.com&url=http://www.231231.com THIS STUFF HERE SHALL BE DELETED TOO ????
      mifgfgf.com&url=http://www1.dfgdfg.de
      micfgfgf.com&url=http:nothing to do cause no http and address here !!!
      fgdddfgdfg.com&url=http://last.one.here.it
      and the output is:
      dict.leo.org
      http://www.231231.com
      www1.dfgdfg.de
      micfgfgf.com&url=http:nothing to do cause no http and address here !!!
      last.one.here.it
      rds Bego :D
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      4
      NewbieNewbie
      4

        Nov 09, 2005#3

        THX Alot Bego

        You Dit save my day THX Agen 8)

          Nov 09, 2005#4

          Ups i see it dit take the http:// away so if you can fix that 2 then i owe you one m8.

          My Mistage :oops:
          by the way i dit show you the example with out the http://

          I will show you precise what i dit want to tell you :lol:

          Example Before Cleaning

          Code: Select all

          http://www.tv.com/o.php?p=75&url=http://www.disney.com
          After Cleaning looks like this

          Code: Select all

          http://www.disney.com
          I need the Http:// now i will youst fix it with exel this time
          but if you can change the macro agen then, it will be more easy
          to next time....

          And Thx ALOT 4 YOU HELP M8 :wink:

          344
          MasterMaster
          344

            Nov 09, 2005#5

            Hi gto get what you want. Sooo. I think I know:
            Try this:

            Code: Select all

            InsertMode
            ColumnModeOff
            HexOff
            UnixReOn
            Clipboard 9
            Find "url=http://"
            IfFound
            Key RIGHT ARROW
            Key LEFT ARROW
            Find RegExp Select "($|[ ])"
            IfFound
            Cut 
            DeleteToStartofLine
            DeleteToEndofLine
            "http://"
            Paste 
            EndIf
            Key DOWN ARROW
            Key HOME
            EndIf
            Clipboard 0
            I just extended the search to url=.... and the typed it again if found, so:
            http://www.tv.com/o.php?p=75&url=http://www.disney.com
            http://www.lala.com/o.php?p=75&url=http://www.disney.com just another dumb stuff here to clean
            http://www.tv.com/o.php?p=75&url=http//www.errorMissingColon.com
            http://www.lala.com/o.php?p=75&url=http://www.this.one.works.too
            gets to
            http://www.disney.com
            http://www.disney.com
            http://www.tv.com/o.php?p=75&url=http//www.errorMissingColon.com
            http://www.this.one.works.too
            Hope it helps.

            rds Bego
            Normally using all newest english version incl. each hotfix. Win 10 64 bit

            4
            NewbieNewbie
            4

              Nov 09, 2005#6

              THX ALOT BRO

              :lol: :D :lol: :D 8) :o