Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] How to remove lines with certain words

Expand Messages
  • Alec Burgess
    Hi Palladin: Now that you re here, I ll give you a way to remove all doubleclick entries without using a clip :-) but it requires you use Find/Replace and set
    Message 1 of 5 , Aug 4, 2004
    • 0 Attachment
      Hi Palladin:

      Now that you're here, I'll give you a way to remove all doubleclick entries
      without using a clip :-) but it requires you use Find/Replace and set the
      "Use regular expression" in the Replace dialog.

      Find=".*doubleclick.*"
      Replace=""
      (without the quotes on both)

      this will leave a blank line where the original entry was. You can then use
      Modify-Lines-Compress to get rid of the blank lines.

      This Find/Replace would both remove the line and the following line-break in
      one step.
      Find=".*doubleclick.*\n"
      Replace=""
      (without the quotes on both)

      This would allow you to three at the same time:
      Find=".*.*(doubleclick)|(ebay)|(shock).*\n"
      Replace=""
      (without the quotes on both)

      in your example this would leave only:
      > 127.0.0.1 www.greenvalley-ads.servers.net
      > 127.0.0.1 www.go.ad.client-servers.com

      Note: make sure you've got a backup and give these find replaces's some time
      to work - they may take awhile regular expression find/replace on large
      files can be fairly slow.

      For your future use this one line clip is the equivalent of doing the
      doubleclick subsitution (this time the quotes ARE required).

      ^!replace =".*doubleclick.*\n" >> "" rwsa

      so once you've verified its working as you want you could make a clip like
      this:

      H="do many replaces"
      ^!replace =".*doubleclick.*\n" >> "" rwsa
      ^!replace =".*badads.*\n" >> "" rwsa
      ^!replace =".*otherbadadd.*\n" >> "" rwsa

      If this is *too* slow for the size of your hosts file post back and some one
      will show you how to do it using a looping pass through the hosts file.

      Regards ... Alec
      --

      ---- Original Message ----
      From: "Palladin" <billy-shears@...>
      To: <ntb-Clips@yahoogroups.com>
      Sent: Wednesday, August 04, 2004 11:35
      Subject: [gla: [Clip] How to remove lines with certain words

      > Hi all,
      > First things first. I don't even know what a Clip is, but
      > I posted
      > the following question in the basic area, and was told to
      > post here,
      > as I most likely needed a Clip to achieve what I need
      > NoteTab to do.
      > My question involves whether NoteTab has the ability to
      > remove
      > lines from a text file that contain a certain keyword, or
      > string.
      >
      > What I'm doing is compiling a Hosts file to block certain
      > undesirable
      > sites from being downloaded to my PC. If I redirect my PC
      > to itself
      > when a certain site is being called on, undesirable sites
      > can be blocked.
      > The Hosts file is the second filter in the process, and I
      > need to pare
      > it down. My other filter will be blocking the hosts that
      > I remove from
      > the Hosts file. I won't bore you with the details, but
      > for more info on
      > the Hosts file and how it blocks undesirable sites, a
      > good place is:
      >
      > http://www.mvps.org/winhelp2002/hosts.htm
      >
      > Anyway, here is a very small sample of what a Hosts file
      > looks like:
      >
      > 127.0.0.1 ad.3au.doubleclick.net
      > 127.0.0.1 popup.dk.doubleclick.com
      > 127.0.0.1 www.greenvalley-ads.servers.net
      > 127.0.0.1 ad4.popups-doubleclick.com
      > 127.0.0.1 doubleclick.shockwave.com
      > 127.0.0.1 www.ebay.doubleclick.net
      > 127.0.0.1 www.go.ad.client-servers.com
      > 127.0.0.1 gd12.doubleclick.serverclient.net
      >
      > There's thousands of these "hosts", or websites, in my
      > Hosts file.
      > What I need NoteTab to do is remove all host entries that
      > contain
      > a certain word, or "string", that I specify, because I
      > also use another
      > filter method based on keywords, and want to slim my huge
      > Hosts
      > file down, for several reasons. So far I have not been
      > able to figure
      > out how to do it with my NoteTab, but I do feel that
      > NoteTab can.
      >
      > For instance, if I specify that NoteTab remove all
      > entries that contain
      > the word "doubleclick" from the list above, NoteTab would
      > delete or separate from the list 6 of the 8 hosts.
      >
      > A keyword like "doubleclick" will remove several hundred
      > hosts!
      > There will be around 200 of these keywords I will use to
      > pare down
      > my very large Hosts file. If I could specify all 200
      > words in the same
      > operation, that would be even better, but I'll settle for
      > one at a time.
      > Hope I have explained the task clearly enough. It's
      > important to me.
      > Is any of this possible with NoteTab? And if so, how?
      > Thanks, Billy
      >
      >
      >
      > _______________________________________________
      > Join Excite! - http://www.excite.com
      > The most personalized portal on the Web!
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
    • Alec Burgess
      Pallidin: Follow up ... if instead of Find= .*(doubleclick)|(ebay)|(shock).* n you use instead: Find= 127.*(doubleclick)|(ebay)|(shock).* n or
      Message 2 of 5 , Aug 4, 2004
      • 0 Attachment
        Pallidin:

        Follow up ...
        if instead of
        Find=".*(doubleclick)|(ebay)|(shock).*\n"

        you use instead:
        Find="127.*(doubleclick)|(ebay)|(shock).*\n" or
        Find="^127.*(doubleclick)|(ebay)|(shock).*\n" or


        it looks like it will work a *lot* faster. (Starting a regular expression
        with .* which means match anything - including nothing at all makes Notetab
        do a lot of unneccesary work)

        Regards ... Alec
        --


        ---- Original Message ----
        From: "Palladin" <billy-shears@...>
        To: <ntb-Clips@yahoogroups.com>
        Sent: Wednesday, August 04, 2004 11:35
        Subject: [gla: [Clip] How to remove lines with certain words
      • Jeff Scism
        I would like to see a Line Number ruler on the left of the Text window.... (of course it would scroll WITH the text_)..... -- ~~ Jeffery G. Scism. IBSSG Just
        Message 3 of 5 , Aug 4, 2004
        • 0 Attachment
          I would like to see a Line Number ruler on the left of the Text
          window.... (of course it would scroll WITH the text_).....
          --
          ~~

          Jeffery G. Scism. IBSSG

          "Just the facts, maam."
          Sgt. Joe Friday,
          LAPD Badge #714
        • Jody
          Hi Alec, Hopefully, Pallidin will not get an Out of Memory message. I quit using regular expressions when doing large files and large manipulations/editing.
          Message 4 of 5 , Aug 4, 2004
          • 0 Attachment
            Hi Alec,

            Hopefully, Pallidin will not get an "Out of Memory" message. I
            quit using regular expressions when doing large files and large
            manipulations/editing. NoteTab's Clip code it much faster running
            also. It takes longer to write the code of course, but there's
            certainly a lot less headaches in the long run. As you know
            though, at times, the Clip Code can't do what is needed.
            Sometimes when using the RegExp, one must either break the file
            down into many smaller ones or run multiple Clip with RegExp in
            each instead of the long one and even restarting NoteTab between
            each run.

            >Follow up ...
            >if instead of
            >Find=".*(doubleclick)|(ebay)|(shock).*\n"


            Happy Clip'n!
            Jody

            www.clean-funnies.com, http://www.fookes.us/maillist.htm

            Subscribe: mailto:ntb-Clips-Subscribe@yahoogroups.com
            UnSubscribe: mailto:ntb-Clips-UnSubscribe@yahoogroups.com
            Options: http://groups.yahoo.com/group/ntb-clips
          • Alec Burgess
            ... Right-click in the input box for the Find or Replace dialog and select Font. (I use 12 pt. bold Lucinda Console) Also: Left-click on the icon for either
            Message 5 of 5 , Aug 6, 2004
            • 0 Attachment
              Billy:
              > ps - Is there a way to increase the font size for the
              > regular
              > text used in NoteTab? I have a hard time entering some of
              > the
              > close together characters involved with entering the
              > Regular Expression into the Find/Replace box. There are
              > those hard (to me) to distinguish )|( that are very, very
              > tiny. I'm using 1024x768. I know we can increase the font
              > on the document
              > we're editing, but I haven't found where other screen font
              > sizes can be modified. Have a great weekend...

              Right-click in the input box for the Find or Replace dialog and select Font.
              (I use 12 pt. bold Lucinda Console)

              Also: Left-click on the icon for either dialog for option to save window
              state - Its handy to keep it sized a little bigger than normal and
              positioned up top so it doesn't overlap the main input area.

              Regards ... Alec
              --


              ---- Original Message ----
              From: "billy_b_shears" <mem357@...>
              To: <ntb-clips@yahoogroups.com>
              Sent: Friday, August 06, 2004 10:47
              Subject: [gla: Re: [Clip] How to remove lines with certain
              words
            Your message has been successfully submitted and would be delivered to recipients shortly.