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

16645[Clip] Re: Creation of clip

Expand Messages
  • idisnick
    Jun 19, 2007
    • 0 Attachment
      Hi,
      It worked but it left empty spaces unlike the last one. Can you make
      it so it closes the space? Also it took a few minutes to do a list of
      24,000, any way to speed it up?
      Thanks!



      --- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...>
      wrote:
      >
      > Give this a try (note one long line):
      > ;clip to remove lines that do contain keywords
      > ;keywords go in a file with one keyword per line
      > ;start with the file to be parsed open
      > ;whacked at by don at htmlfixit dot com
      > ;used regex proposed by pat
      >
      > :StartOfClip
      > ;long line follows
      > ^!Set %Keywords%=^?{(T=O;F="Textfiles (*.txt)|*.txt")Choose Keyword
      File:}
      > ;long line preceeds
      >
      > :GetKeywords
      > ^!Open ^%Keywords%
      > ; Remove empty lines in keyword list
      > ^!Replace "(\r\n){2,}" >> "\r\n" AWRS
      > ; Put keywords into alternation
      > ^!Replace "\r\n" >> "|" AWRS
      > ; Remove "empty alternation" at list end
      > ^!Replace "\|\Z" >> "" AWRS
      > ^!Select All
      > ^!Set %Search%=^$GetSelection$
      > ^!Close Discard
      >
      > ;be sure we are back on proper document
      > ^!Set %Doc%=^$GetDocIndex$
      > ^!SetWordWrap Off
      > ^!Jump Doc_Start
      > ^!SetDebug On
      >
      >
      > :Loop
      > ^!Select Eol
      > ^!Find ".*(^%Search%).*" TIHRS
      > ;this deletes line if contains keyword
      > ^!IfError Continue
      > ^!InsertText ^%EMPTY%
      > ^!Goto Loop
      >
      > :Continue
      > ;finish if end of file is reached
      > ^!If ^$GetRow$ = ^$GetLinecount$ Finish
      > ;this moves to next line if keyword not found
      > ^!Jump +1
      > ^!Goto Loop
      >
      > :Finish
      > ;clean up empty line at start if exists
      > ^!Jump Doc_Start
      > ^!Select Eol
      > ^!If "getselection" = "" Skip_2
      > ^!SelectTo 2:1
      > ^!InsertText ^%EMPTY%
      >
      > :EmptyLinesOut
      > ;clean out all empty lines after deletion
      > ^!Replace "^P^P" >> "^P" ACIWS
      > ^!IfError End
      >
    • Show all 30 messages in this topic