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

21836Re: [Clip] Remove all lines not containing something

Expand Messages
  • Don
    Jun 28, 2011
      > **** I should have been clearer when I initially posted the question
      > that I was *NOT* looking for a clip but simply a Regex pattern. ****

      I can use a clip for this project, but I wonder if a regex could do it.

      I want to essentially ask for data that I do not want to find in a line
      and if that data is not in the line, delete the line.

      We conclude the other day that negative classes were character at a time
      (I think).

      I was trying something like this (not expecting it to quite work obviously):
      ^!Set %DataStuff%=org|net
      ^!Replace ".*[^%DataStuff].*\r\n" >> "" RAWH

      For the moment assume I want to remove all .com email addresses from a
      list (in the end I want to prompt for the search phrase).

      I was doing it with a stepped clip, but it keeps jumping out of the loop
      half way through a job. I think it may be a keyboard delay issue as I
      use the backspace key.



      Existing clip:
      ^!Jump Doc_Start
      ^!Set %DataStuff%=^?{Term to Search For, Pipe Separated}
      ^!Select Eol
      ^!If "^$GetSelection$" <> "" Skip_2
      ^!Keyboard DELETE
      ^!Goto Advance

      ^!Find "^%DataStuff%" TIHRS
      ^!IfError Next ELSE JumpLine
      ^!If ^$GetRow$ = ^$GetLinecount$ End
      ^!Goto Advance

      ^!If ^$GetRow$ = ^$GetLinecount$ Next ELSE Skip_2
      ^!Goto End
      ^!Jump +1

      ;end at end of file
      ^!Goto Loop

      This clip works pretty well but derails occasionally -- again I think a
      keyboard issue. It also misses the last line so I need to think that
      through better.
    • Show all 30 messages in this topic