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

Re: [Clip] Clip program to edit a list according to certain criteria

Expand Messages
  • Alec Burgess
    Frank: Following clip does all four tasks. You can split them up into four if you need to. If your source file is too large you might find this clip takes an
    Message 1 of 1 , Jul 31, 2005
    • 0 Attachment
      Frank:

      Following clip does all four tasks. You can split them up into four if you
      need to.
      If your source file is too large you might find this clip takes an
      inordinate length of time to complete :-(

      If that is the case, then each ^!replace .... can be replaced by:

      :loop
      ^!find .....
      ^!iferror exit
      ^!insert required replacement text
      ^!goto loop


      57-31 for Mark - deletes
      ; Alec Burgess 2005-07-31 (Sun)
      ;^!setdebug ON
      ; delete various lines.
      ; 1-more than 25 chars
      ; 2-any digits
      ; 3-any punctation
      ; 4-forbidden words --> *****
      ; note: replace 1,2,3 are wrapped in "(--something--\n)+" to prevent skipped
      lines when two matches occur in a row.

      ; 1-any run of paragraphs with more than 25 chars
      ^!replace "^(..........................+\s*\n)+" >> "" rwsait

      ; 2-delete any run with digits
      ^!replace "^(.*[0-9].*\n)+" >> "" rwsait

      ; 3-delete any run with any punctuation
      ; non-word definition (from Regexp HELP):
      ; \w any word delimiter. Matches any of \t\s!"&()*+,-./:;<=>?@[\]^`{|}~
      ; remove tab/space from this list ...
      ; note: which punctuation characters require escaping "\" determined by
      pasting above list into [Find] box while [o] Regular Expression checked.
      ^!set anyPunct="[!"\&\(\)\*\+,-\./:;<=>\?@\[\\\]\^`\{\|\}~]"
      ^!replace "^(.*^%anyPunct%.*\n)+" >> "" rwsait

      ; replace forbidden words with asterisks.
      ; expand this list as required.
      ^!set forbiddenWords=(worda)|(wordb)|(wordc)
      ^!replace "(^%forbiddenWords%)" >> "*****" rwsait


      Input I tested on .... :
      short line
      long line more than twenty-six characters with trailing spaces
      short line
      long line more than twenty-six characters with trailing spaces
      another long line more than twenty-six characters with trailing spaces
      line with no punctuation
      line with comma, and .
      line with no punctuation
      line with comma, and .
      line with comma, and .
      line with no digits
      line 123 with digits
      line with no digits
      line 123 with digits
      next 123 with digits
      line not forbidden
      forbidden worda
      no forbidden
      wordb wordc forbidden
      wordb wordA forbidden
      this is the end


      Result after running above clip .... :
      short line
      short line
      line with no punctuation
      line with no punctuation
      line with no digits
      line with no digits
      line not forbidden
      forbidden *****
      no forbidden
      ***** ***** forbidden
      ***** ***** forbidden
      this is the end

      Regards ... Alec
      --
      ; ( ) { } [ ] \ | 9 0 + = () {} []


      ---- Original Message ----
      From: "frankrazer" <frankrazer@...>
      To: <ntb-clips@yahoogroups.com>
      Sent: Sunday, July 31, 2005 16:04
      Subject: [gla: [Clip] Clip program to edit a list according
      to certain criteria

      > Hi,
      >
      > I am new to clip programing...
      >
      > I need to search and then edit a list according to
      > certain criteria:
      >
      > 1. Delete all strings (paragraphs)that are >25 characters
      > in length
      > including spaces and then delete them...
      >
      > example:
      >
      > aaaaa aaaaa aaaaaaaaaa aaa (Keep, 25 characters long)
      > aaaaa aaaaa aaaaaaaaaa aaaa (Delete, 26 characters long)
      >
      > ****Not including any spaces at the end of a string on
      > each line
      >
      > 2. Search and delete all paragraphs with any numbers in
      > them
      >
      > 3. Search and delete all paragraphs with any Punctuation
      > in them
      >
      > 4. Compare every paragraph(ie. every word)in the
      > document to
      > another
      > list of words and if any matches are found to replace
      > with a string
      > of
      > asterisks....case does not matter
      >
      > Please could you suggest which commands I need and how to
      > repeat the
      > commands to act on the document
      >
      > I intend to write a separate clip for each of the above
      > criteria
      >
      > Regards
      >
      >
      > Frank
      >
      >
      >
      >
      >
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      > --------------------~--> <font face=arial size=-1><a
      >
      href="http://us.ard.yahoo.com/SIG=12h488gog/M=362335.6886445.7839731.1510227
      /D=groups/S=1705007389:TM/Y=YAHOO/EXP=1122850433/A=2894361/R=0/SIG=13jmebhbo
      /*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO
      &cmpgn=GRP&RTP=http://groups.yahoo.com/">In
      > low income neighborhoods, 84% do not own computers. At
      > Network for Good, help bridge the Digital
      > Divide!</a>.</font>
      > --------------------------------------------------------------------~->
      >
      > Fookes Software: http://www.fookes.us,
      > http://www.fookes.com
      > Fookes Software Mailing Lists:
      > http://www.fookes.us/maillist.htm
      >
      > Yahoo! Groups Links
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.