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

Re: How to set a clip capable of deleting lines without particaluar content?

Expand Messages
  • ebbtidalflats
    ... Sure thing. There are lots of ways to do this. Advance one line at a time, check for your test string, delete the line if the string is not present. The
    Message 1 of 32 , Jul 4, 2007
      --- In ntb-clips@yahoogroups.com, ¼@±¡¨g <rmexe32@...> wrote:
      >
      > Hi All! I am a newcomer here and I have just used NoteTab for a short
      > time. I would want to create a clip that could search through the file
      > and delete all lines without the string the user entered.
      >
      > Could this actually be achieved? Any help would be appreciated.
      >

      Sure thing.
      There are lots of ways to do this.

      Advance one line at a time, check for your test string,
      delete the line if the string is not present.

      The simplest way is to start at the end of the doc
      (because you'll be deleting lines, and a number of tests change):

      Select the clip between lines, copy to clipboard, open any clipbook,
      and click on "Add from clipboard":

      ---------------------------
      H="Delete Line Without Target Text"
      ;cursor at end of doc
      ^!Set %row%=^$GetLineCount$; %col%=1
      ^!Set %test%=^?{Enter a string you MUST have in each line}
      :LOOP
      ^!SetCursor ^%row%:^%col%
      ^!Select LINE
      ;check for presence of target string
      ^!If ^$StrPos("^%test%";"^$GetSelection$";0)$ > 0 SKIP
      ^!DeleteLine
      ;delete the line if target is missing, move cursor to previous line
      ^!Dec %row%
      ^!If ^%row%>=1 LOOP
      ------------------------------------


      Cheers,


      Eb
    • loro
      ... Thank you, Flo. At least there is a significant difference. I m a little shocked. I hadn t noticed before that Notetab has gotten slower in some respects.
      Message 32 of 32 , Jul 6, 2008
        Flo wrote:
        >With ^!SetScreenUpdate Off your Clip needs 32 seconds to run my test
        >(reducing 15,000 to 234 lines). I'm working with a 1,6-GHz-Notebook.

        Thank you, Flo. At least there is a significant difference. I'm a
        little shocked. I hadn't noticed before that Notetab has gotten
        slower in some respects.

        Lotta
      Your message has been successfully submitted and would be delivered to recipients shortly.