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

Re: [Clip] How to invoke a clip

Expand Messages
  • John B Shotsky
    Since I get files from the interenet, and have no idea of the CRLF format of received files, I always use R to detect any form of single or double characters,
    Message 1 of 33 , Nov 27, 2009
    • 0 Attachment
      Since I get files from the interenet, and have no idea of the CRLF format of
      received files, I always use \R to detect any form of single or double
      characters, and replace with \r\n so that I know that whatever form is in
      the text, my replacement will be successful.

      So
      ^!Replace "\R" >> "\r\n" ARTSW
      provides that all forms of CRLF or CR or LF or LFCR are replaced with one
      known entitiy. Then, throughout my libraries, I continue to use \R to detect
      any form of line end. If I want to remove only excess blank lines, but
      retain them between paragraphs, I use
      ^!Replace "\R\R+" >> "\r\n\r\n" ARTSW
      John

      > > Regarding your latest sample data, it appears to be dispensable
      > > to search for complete IP-adresses. The only numbers at the start
      > > of any line (or paragraph) are IP-adresses.
      >
      >Yes, and then the unexpected happens. I've found it pays to make
      >searches as specific as reasonable possible. For me this means looking
      >for four number groups because this is quick and easy and not checking
      >the ranges for 254 or less, as that makes it too complicated to be worth
      >it. No hard rules here, but more specific is better.

      > Yes, I heartily concur! It is much easier to overkill the criteria and
      > error
      > messages than debug obscure coding errors.
      >
      >
      > > > To actually delete empty lines only you have to write...
      > > > ^!If ^$GetLineSize$ > 0 Skip
      > > > ^!DeleteLine
      > >
      > >I wasn't sure if CR LF were counted as two characters or not and too
      > >lazy to try. As they're not, you're right and this is an example of more
      > >specific being better: A line with just one or two characters may be
      > >improbable but it is possible.
      >
      > Actually, the CRLF sequence IS two characters which you can verify
      > by creating a new doc with two or more blank lines and running this clip:
      >
      > ^!Jump Doc_Start
      > ^!Select +2
      >
      > Only one line is selected. If the CRLF was only one character, 2 lines
      > would be selected. If you try selecting just 1 character, nothing is
      > selected.
      >
      > Unsing the adage "If it works, don't fix it", I have been using this
      > snippet
      > to delete an empty line:
      >
      > ^!Select +2
      > ^!Replace "^P" >> "" HS
      >
      > But with the ideas brought out in this thread and my strong preference
      > for non-crossing flow chart lines (a la Nassi-Shneiderman diagrams) and
      > to make the code more readable, I will now use this snippet:
      >
      > ^!If ^$GetLineSize$ = 0 ^!DeleteLine
      >
      > Thanks,
      >
      > Namaste', Art
      >
      > ----------
      >
      > No virus found in this outgoing message.
      >
      > Checked by AVG - www.avg.com
      > Version: 9.0.709 / Virus Database: 270.14.84/2530 - Release Date: 11/26/09
      > 23:58:00
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >


      [Non-text portions of this message have been removed]
    • John B Shotsky
      Since I get files from the interenet, and have no idea of the CRLF format of received files, I always use R to detect any form of single or double characters,
      Message 33 of 33 , Nov 27, 2009
      • 0 Attachment
        Since I get files from the interenet, and have no idea of the CRLF format of
        received files, I always use \R to detect any form of single or double
        characters, and replace with \r\n so that I know that whatever form is in
        the text, my replacement will be successful.

        So
        ^!Replace "\R" >> "\r\n" ARTSW
        provides that all forms of CRLF or CR or LF or LFCR are replaced with one
        known entitiy. Then, throughout my libraries, I continue to use \R to detect
        any form of line end. If I want to remove only excess blank lines, but
        retain them between paragraphs, I use
        ^!Replace "\R\R+" >> "\r\n\r\n" ARTSW
        John

        > > Regarding your latest sample data, it appears to be dispensable
        > > to search for complete IP-adresses. The only numbers at the start
        > > of any line (or paragraph) are IP-adresses.
        >
        >Yes, and then the unexpected happens. I've found it pays to make
        >searches as specific as reasonable possible. For me this means looking
        >for four number groups because this is quick and easy and not checking
        >the ranges for 254 or less, as that makes it too complicated to be worth
        >it. No hard rules here, but more specific is better.

        > Yes, I heartily concur! It is much easier to overkill the criteria and
        > error
        > messages than debug obscure coding errors.
        >
        >
        > > > To actually delete empty lines only you have to write...
        > > > ^!If ^$GetLineSize$ > 0 Skip
        > > > ^!DeleteLine
        > >
        > >I wasn't sure if CR LF were counted as two characters or not and too
        > >lazy to try. As they're not, you're right and this is an example of more
        > >specific being better: A line with just one or two characters may be
        > >improbable but it is possible.
        >
        > Actually, the CRLF sequence IS two characters which you can verify
        > by creating a new doc with two or more blank lines and running this clip:
        >
        > ^!Jump Doc_Start
        > ^!Select +2
        >
        > Only one line is selected. If the CRLF was only one character, 2 lines
        > would be selected. If you try selecting just 1 character, nothing is
        > selected.
        >
        > Unsing the adage "If it works, don't fix it", I have been using this
        > snippet
        > to delete an empty line:
        >
        > ^!Select +2
        > ^!Replace "^P" >> "" HS
        >
        > But with the ideas brought out in this thread and my strong preference
        > for non-crossing flow chart lines (a la Nassi-Shneiderman diagrams) and
        > to make the code more readable, I will now use this snippet:
        >
        > ^!If ^$GetLineSize$ = 0 ^!DeleteLine
        >
        > Thanks,
        >
        > Namaste', Art
        >
        > ----------
        >
        > No virus found in this outgoing message.
        >
        > Checked by AVG - www.avg.com
        > Version: 9.0.709 / Virus Database: 270.14.84/2530 - Release Date: 11/26/09
        > 23:58:00
        >
        > [Non-text portions of this message have been removed]
        >
        >
        >


        [Non-text portions of this message have been removed]
      Your message has been successfully submitted and would be delivered to recipients shortly.