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

How to remove lines with certain words

Expand Messages
  • Palladin
    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
    Message 1 of 8 , Aug 4, 2004
    • 0 Attachment
      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!
    • Jody
      Hi Palladin, ... See Help | NoteTab s Glossary... Double click on About Number Lines in the nnnLines Library for more information. It reads: ;About Number
      Message 2 of 8 , Aug 4, 2004
      • 0 Attachment
        Hi Palladin,

        >First things first. I don't even know what a Clip is,

        See Help | NoteTab's Glossary...

        Double click on "About Number Lines" in the nnnLines Library for
        more information. It reads:

        ;About Number Lines
        Last updated on 08-02-2004 by Jody@...
        http://www.notetab.net/zip/nnnlines.zip
        Extract to NoteTab's Libraries folder
        Fookes Software Home
        http://www.fookes.com/regnow.html?2448&item=home

        Get more Clips, Libraries... at:
        The NoteTabbers Assistant Page
        http://www.notetab.net

        Position your cursor over the clips and look at the status bar for a tip.

        <snip>

        I suggest that you just download the Library above since you
        don't know about Clips. The H= line below is a very long line. If
        it gets hard breaks in it use the Join Lines to to wrap it or
        edit manually. Follow the wrapper instructions below to add to a
        Library. The Clip above this one in it has instructions on how to
        hard code the Clip so the wizard doesn't popup. The
        ^!SetWizardTitle at the end is also long.

        <--- Copy below this line --->
        H=DeleteLine if it contains... Prompt follows to insert comma delimited string. Deletes all lines in document if they contain the string you specify.
        ; eMailed on 08-04-2004, ntb-clips@yahoogroups.com, Jody
        ; notetab.net, clean-funnies.com, fookes.us, sojourner.us

        ; Last updated on 08-02-2004 by Jody Adair
        ; http://www.fookes.us/redir, http://www.notetab.net
        ^!SetHintInfo Removing lines...
        ^!SetScreenUpdate Off
        ^!ClearVariable %DeleteList%

        ; *******************************************
        ; Edit the Clip above if you do not want the
        ; wizard to popup, see the notes in it.
        ; *******************************************

        ^!SetListDelimiter ,
        ^!SetArray %StringList%=^?{Enter comma delimited string (Example: dude,bad,tech)}
        ^!Set %Count%=^%StringList0%
        ^!Set %Index%=0; %DeleteCount%=0

        :Loop1
        ^!Jump 1
        ^!Inc %Index%
        ^!If ^%Index% > ^%Count% Stats

        :Loop2
        ^!Find "^%StringList^%Index%%" SITC
        ^!IfError Loop1
        ^!Select Line
        ^!Set %LineDeleted%=^$GetSelection$
        ; ^!DeleteLine
        ^!Toolbar Clear All
        ^!Inc %DeleteCount%
        ^!Append %DeleteList%=^%LineDeleted%
        ^!Goto Loop2

        :Stats
        ^!Jump 1
        ; long line follows
        ^!SetWizardTitle Get more Libraries & Clips at the NoteTabbers Assistant Page: http://www.notetab.net
        ^!Info [L]Number of lines deleted: ^%DeleteCount%^p^p^%DeleteList%

        <--- Copy above this line --->
        <--- Right click over a Library --->
        <--- Choose: Add from Clipboard --->

        >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


        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
      • billy_b_shears
        ... delimited string. Deletes all lines in document if they contain the string you specify. ... dude,bad,tech)} ... Assistant Page: http://www.notetab.net ...
        Message 3 of 8 , Aug 6, 2004
        • 0 Attachment
          --- In ntb-clips@yahoogroups.com, Jody <kjv-av1611@e...> wrote:

          > Hi Palladin,
          >
          > snip
          >
          > I suggest that you just download the Library above since you
          > don't know about Clips. The H= line below is a very long line. If
          > it gets hard breaks in it use the Join Lines to to wrap it or
          > edit manually. Follow the wrapper instructions below to add to a
          > Library. The Clip above this one in it has instructions on how to
          > hard code the Clip so the wizard doesn't popup. The
          > ^!SetWizardTitle at the end is also long.
          >
          > <--- Copy below this line --->
          > H=DeleteLine if it contains... Prompt follows to insert comma
          delimited string. Deletes all lines in document if they contain the
          string you specify.
          > ; eMailed on 08-04-2004, ntb-clips@yahoogroups.com, Jody
          > ; notetab.net, clean-funnies.com, fookes.us, sojourner.us
          >
          > ; Last updated on 08-02-2004 by Jody Adair
          > ; http://www.fookes.us/redir, http://www.notetab.net
          > ^!SetHintInfo Removing lines...
          > ^!SetScreenUpdate Off
          > ^!ClearVariable %DeleteList%
          >
          > ; *******************************************
          > ; Edit the Clip above if you do not want the
          > ; wizard to popup, see the notes in it.
          > ; *******************************************
          >
          > ^!SetListDelimiter ,
          > ^!SetArray %StringList%=^?{Enter comma delimited string (Example:
          dude,bad,tech)}
          > ^!Set %Count%=^%StringList0%
          > ^!Set %Index%=0; %DeleteCount%=0
          >
          > :Loop1
          > ^!Jump 1
          > ^!Inc %Index%
          > ^!If ^%Index% > ^%Count% Stats
          >
          > :Loop2
          > ^!Find "^%StringList^%Index%%" SITC
          > ^!IfError Loop1
          > ^!Select Line
          > ^!Set %LineDeleted%=^$GetSelection$
          > ; ^!DeleteLine
          > ^!Toolbar Clear All
          > ^!Inc %DeleteCount%
          > ^!Append %DeleteList%=^%LineDeleted%
          > ^!Goto Loop2
          >
          > :Stats
          > ^!Jump 1
          > ; long line follows
          > ^!SetWizardTitle Get more Libraries & Clips at the NoteTabbers
          Assistant Page: http://www.notetab.net
          > ^!Info [L]Number of lines deleted: ^%DeleteCount%^p^p^%DeleteList%
          >
          > <--- Copy above this line --->
          > <--- Right click over a Library --->
          > <--- Choose: Add from Clipboard --->
          >
          > snip
          >
          >
          > Happy Clip'n!
          > Jody
          >


          Jody,
          Thanks so much for the clip! I now know what a clip is. It's a
          utility script, right? And and this one works just great! As does
          the Regular Expression version that Alec posted. Thanks Alec!
          The only small problem I had with the RegExp method was that
          it was fairly easy to get an "out of memory" error. But that was
          when I tried to find/replace too many words at a time. I haven't
          really tried very many words at a time with the Clip yet, I think I
          tried 6, but it worked with no complaints. And I have certainly
          have no complaints with these two great apps, either. <:o)}
          Y'all are good people, and I'm going to pass the word for folks
          to go to Jodys' site and consider purchasing some of the fine
          software products. Thanks again Jody and Alec! Happy Clip'n!
          Billy
          aka Palladin

          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...
        • Jody
          Hi Billy, ... Yes, Clips are made up of a scripting code we call Clip Code and the act of writing them is called Clipbook Programming or writing a Clip.
          Message 4 of 8 , Aug 6, 2004
          • 0 Attachment
            Hi Billy,

            >> H=DeleteLine if it contains...
            >
            > Jody,
            >Thanks so much for the clip! I now know what a clip is. It's a
            >utility script, right?

            Yes, Clips are made up of a scripting code we call Clip Code and
            the act of writing them is called Clipbook Programming or writing
            a Clip. <g> Yes, Clips are scripts. ;)

            >And and this one works just great! As does the Regular Expression
            >version that Alec posted. Thanks Alec! The only small problem I
            >had with the RegExp method was that it was fairly easy to get an
            >"out of memory" error.

            I figured as much with what you are doing. My guess is that the
            RegExp bug is that it is not releasing the memory as it uses it
            whereas the Clips do to some extent.

            >But that was when I tried to find/replace too many words at a
            >time. I haven't really tried very many words at a time with the
            >Clip yet, I think I tried 6, but it worked with no complaints.

            It depends on the Windows version, your resources, what you have
            been doing since you rebooted last, how big the file(s) is, how
            long it has been since you restarted NoteTab, etc... You can
            probably do a string in the hundreds though. Normally, what
            happens with NoteTab and Clips w/o RegExp is that they will just
            start going slower and slower depending on what you are doing.
            Very long/large tasks you'll see the mouse pointer start to go
            into the hour glass and Windows might even respond in the
            Titlebar that NoteTab is not responding. It might even appear to
            be locked up, even go all white, but if you let it be it will
            eventually finish. I've made over 1500 web pages with a click
            back on a Win98 machine with perhaps 356MB RAM and a 400MHz AMD
            processor and not that much hard drive. It would take a few
            minutes, hour glass creeping, but would complete. Pro is much
            better about it than Std/Light. It is the input controls used.
            (See Help | NoteTab Glossary.)

            >Y'all are good people, and I'm going to pass the word for folks
            >to go to Jodys' site and consider purchasing some of the fine
            >software products. Thanks again Jody and Alec! Happy Clip'n!

            Thanks much! :) http://www.fookes.us/redir is the shortest link I
            have. :) ...but http://www.notetab.net has stuff there as you
            know.

            >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.

            Right click in the Find and Replace fields and change the font
            and/or size. See the Clipbook tab in Options for the font in it.
            Right click over the Quick List (F6) to change the font in it.
            Also see View | Printing Options...

            Click on the Titlebar icon of the Favorites dialog (F2) and the
            Find/Replace dialogs after resizing them to Save Window State.
            No extra charge for that tidbit. :)

            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
          • hsavage
            ... Palladin, I know you already have a clip from Jody to remove lines from your Hosts file. Here is yet another approach to do the same thing in a slightly
            Message 5 of 8 , Aug 6, 2004
            • 0 Attachment
              Palladin wrote:
              > 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.
              >
              > 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,
              >
              > 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!

              Palladin,

              I know you already have a clip from Jody to remove lines from your Hosts
              file.

              Here is yet another approach to do the same thing in a slightly
              different way. The main difference is you create the Wordlist.txt file
              prior to running the clip.

              Make a simple columnized list of the words you want removed, load the
              Hosts file into NoteTab and run the clip.

              This is a link where you can view, and copy and paste the text and
              instructions for the clip.

              http://groups.yahoo.com/group/ntb-clips/files/del-host-entries.txt

              hrs
            • billy_b_shears
              ... Hosts ... file ... the ... HRS, Wow. Just a few days ago I was sure that I would never find a way to accomplish the task I had of deleting lines from a
              Message 6 of 8 , Aug 7, 2004
              • 0 Attachment
                --- In ntb-clips@yahoogroups.com, hsavage <hsavage@p...> wrote:

                > I know you already have a clip from Jody to remove lines from your
                Hosts
                > file.
                >
                > Here is yet another approach to do the same thing in a slightly
                > different way. The main difference is you create the Wordlist.txt
                file
                > prior to running the clip.
                >
                > Make a simple columnized list of the words you want removed, load
                the
                > Hosts file into NoteTab and run the clip.
                >
                > This is a link where you can view, and copy and paste the text and
                > instructions for the clip.
                >
                > http://groups.yahoo.com/group/ntb-clips/files/del-host-entries.txt
                >
                > hrs


                HRS,
                Wow. Just a few days ago I was sure that I would never find a
                way to accomplish the task I had of deleting lines from a Hosts
                file that contained a specified keyword string. But now I have 3
                great utlilties from 3 fine folks to do the job that I needed done.
                It's heartening to see that there are still people who will give of
                their time to a total stranger, asking nothing in return. I can tell
                by looking at these scripts that they took a good amount of time
                and skill to write, and we appreciate the gift. Yes, WE! {:~3-)}
                The 3 solutions fit perfectly the 3 situations that I often find
                myself in regard to the Hosts file. Oftentimes I just have a handful
                of strings to process, and Alecs' RegExp works perfectly there.
                Sometimes I have a good number of strings scattered among
                non-keywords, and Jodys' Clip works perfectly there. And finally,
                sometimes I have a clean columnar list of nothing but keywords
                to process, and HRS' fits the bill to a tee. I am blessed. <:o)}
                HRS, do you know if it's possible to add extra coding to your
                Clip that would allow me to view the 'Deleted Hosts' file in real
                time as it is being populated with removed hosts? Of course,
                that's not necessary for your Clip to do it's job, but it's just
                something I'd like to monitor, if it's even possible and not
                hard to implement into the script. Thanks again for your effort.
                Billy
                aka Palladin
              • hsavage
                ... Palladin, Quick Answer; Yes, it s possible, BUT, It would slow the the script completion time considerably because, the Deleted file would have to be
                Message 7 of 8 , Aug 7, 2004
                • 0 Attachment
                  billy_b_shears wrote:
                  > --- In ntb-clips@yahoogroups.com, hsavage <hsavage@p...> wrote:
                  >
                  >
                  >>I know you already have a clip from Jody to remove lines from your
                  >> Hosts file.
                  >>
                  >> Here is yet another approach to do the same thing in a slightly
                  >> different way. The main difference is you create the Wordlist.txt
                  >> file prior to running the clip.
                  >>
                  >>
                  >>http://groups.yahoo.com/group/ntb-clips/files/del-host-entries.txt
                  >>
                  >>hrs
                  >
                  >
                  >
                  > HRS, do you know if it's possible to add extra coding to your
                  > Clip that would allow me to view the 'Deleted Hosts' file in real
                  > time as it is being populated with removed hosts? Of course,
                  > that's not necessary for your Clip to do it's job, but it's just
                  > something I'd like to monitor, if it's even possible and not
                  > hard to implement into the script. Thanks again for your effort.
                  > Billy
                  > aka Palladin

                  Palladin,

                  Quick Answer;
                  Yes, it's possible, BUT, It would slow the the script completion time
                  considerably because, the Deleted file would have to be re-loaded after
                  every line deletion to give you the updated status, at this time the
                  clip would have to be in an idle state because it won't perform its
                  function unless the Hosts file is in focus.

                  After previewing the 'Deleted' file, the Hosts file would have to be
                  re-focused and you would need to strike a 'hotkey' to resume clip
                  operation.

                  As an alternate method of viewing the updated 'Deleted' file, you could
                  -PRESS AND HOLD- a 'hotkey', or, press one 'hotkey' to view the file,
                  then press another 'hotkey' to resume the clip after viewing.

                  You can begin to see the time delay a preview function might take.

                  hrs
                • billy_b_shears
                  ... time ... after ... the ... be ... could ... file, ... Yes, I can see the problems that would be caused by adding a real time view option. It s definitely
                  Message 8 of 8 , Aug 7, 2004
                  • 0 Attachment
                    --- In ntb-clips@yahoogroups.com, hsavage <hsavage@p...> wrote:

                    > Quick Answer;
                    > Yes, it's possible, BUT, It would slow the the script completion
                    time
                    > considerably because, the Deleted file would have to be re-loaded
                    after
                    > every line deletion to give you the updated status, at this time
                    the
                    > clip would have to be in an idle state because it won't perform its
                    > function unless the Hosts file is in focus.
                    >
                    > After previewing the 'Deleted' file, the Hosts file would have to
                    be
                    > re-focused and you would need to strike a 'hotkey' to resume clip
                    > operation.
                    >
                    > As an alternate method of viewing the updated 'Deleted' file, you
                    could
                    > -PRESS AND HOLD- a 'hotkey', or, press one 'hotkey' to view the
                    file,
                    > then press another 'hotkey' to resume the clip after viewing.
                    >
                    > You can begin to see the time delay a preview function might take.
                    >
                    > hrs

                    Yes, I can see the problems that would be caused by adding a real
                    time view option. It's definitely not worth the hassle. Thanks again
                    to Alec, Jody and yourself for taking the time and effort to help!
                    billy
                  Your message has been successfully submitted and would be delivered to recipients shortly.