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

Re: [Clip] Delete lines of varying length that begin with a certain tag. Help?

Expand Messages
  • Jane Peppler
    Eeks, no it didn t work!? This is what my clip looks like now, John: ^!Replace 1 _UID .* R rwais Fail. What am I doing wrong? Ja e
    Message 1 of 12 , Jul 25, 2011
      Eeks, no it didn't work!? This is what my clip looks like now, John:

      ^!Replace "1 _UID .*\R" >> "" rwais

      Fail.

      What am I doing wrong?
      Ja e

      On 25 July 2011 21:52, John Shotsky <jshotsky@...> wrote:
      > The problem is with \$ which says you are looking for a $ in the file. Remove the slash and it will work. However, as
      > written, it will leave blank lines for each of them. To prevent the blank lines, use \R instead of $.
      >
      > Regards,
      > John
      >
      > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Jane Peppler
      > Sent: Monday, July 25, 2011 18:05
      > To: ntb-Clips@yahoogroups.com
      > Subject: [Clip] Delete lines of varying length that begin with a certain tag. Help?
      >
      >
      > Hello friends,
      >
      > I have looked through the clip archives and have also (tried to) read
      > Jody's manual, but I can't figure out how to make the suggestions I
      > found there work. Can you give me a hand?
      >
      > I want to remove -entirely- any line that begins with a certain tag,
      > no matter how long the string of characters that follow.
      >
      > for instance, I want this whole line to just go away, no matter where
      > it appears in the file, no matter how long the code is. It will always
      > begin 1 _UID
      >
      > 1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
      >
      > here's one of the (scores of) variations I tried - saved as a clip,
      > highlighted the whole file and pulled the trigger. Nada:
      >
      > ^!Replace "1 _UID .*\$" >> "" rwais
      >
      > thanks for your help.
      > Jane
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >
      >
      >
      > ------------------------------------
      >
      > Fookes Software: http://www.fookes.com/
      > NoteTab website: http://www.notetab.com/
      > NoteTab Discussion Lists: http://www.notetab.com/groups.php
      >
      > ***
      > Yahoo! Groups Links
      >
      >
      >
      >
    • Jane Peppler
      Argh, no, that did not work either! Thanks for trying though, both of you. Any other ideas? Jane ... [Non-text portions of this message have been removed]
      Message 2 of 12 , Jul 25, 2011
        Argh, no, that did not work either! Thanks for trying though, both of you.
        Any other ideas? Jane

        On 25 July 2011 22:05, Alec Burgess <buralex@...> wrote:

        > **
        >
        >
        > Just \R won't work if "1 _UID" appears on last line in file ... so ...
        > (not tested ;-) )
        > ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
        > where \Z represents end-of-file or buffer
        >
        >
        > On 2011-07-25 21:52, John Shotsky wrote:
        > > The problem is with \$ which says you are looking for a $ in the file.
        > Remove the slash and it will work. However, as
        > > written, it will leave blank lines for each of them. To prevent the blank
        > lines, use \R instead of $.
        > >
        > > Regards,
        > > John
        > >
        > > From:ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On
        > Behalf Of Jane Peppler
        > > Sent: Monday, July 25, 2011 18:05
        > > To:ntb-Clips@yahoogroups.com
        > > Subject: [Clip] Delete lines of varying length that begin with a certain
        > tag. Help?
        > <snip>
        >
        > > 1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
        > >
        > > here's one of the (scores of) variations I tried - saved as a clip,
        > > highlighted the whole file and pulled the trigger. Nada:
        > >
        > > ^!Replace "1 _UID .*\$">> "" rwais
        >
        > --
        > Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
        >
        >
        >


        [Non-text portions of this message have been removed]
      • Art Kocsis
        Jane, John beat me to it (to make it work), but I would add a couple of teaks to the search string make it more reliable, namely: ^1 _UID .*? R The leading ^
        Message 3 of 12 , Jul 25, 2011
          Jane,

          John beat me to it (to make it work), but I would add a couple of teaks to
          the search string make it more reliable, namely:

          ^1 _UID .*?\R

          The leading "^" forces the pattern match to start in column 1 instead of
          anywhere in the line (although I think Flo said it doesn't work in NTB Pro).

          The "?" makes the ".*" non-greedy. RegEx is supposed to stop at the line
          terminator but "just in case...". IMHO, adding a quantifier is a good habit
          to develop.

          Also, you can speed up your coding by developing your search pattern using
          the Menu/Toolbar Find command. Start simple and keep adding to the pattern
          until you're satisfied, then just copy it to the Replace command.

          Namaste', Art

          At 07/25/2011 18:05, you wrote:
          >Hello friends,
          >
          >I have looked through the clip archives and have also (tried to) read
          >Jody's manual, but I can't figure out how to make the suggestions I
          >found there work. Can you give me a hand?
          >
          >I want to remove -entirely- any line that begins with a certain tag,
          >no matter how long the string of characters that follow.
          >
          >for instance, I want this whole line to just go away, no matter where
          >it appears in the file, no matter how long the code is. It will always
          >begin 1 _UID
          >
          >1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
          >
          >here's one of the (scores of) variations I tried - saved as a clip,
          >highlighted the whole file and pulled the trigger. Nada:
          >
          >^!Replace "1 _UID .*\$" >> "" rwais
          >
          >thanks for your help.
          >Jane
        • Don
          ^ is alive and well in pro to signify a line start.
          Message 4 of 12 , Jul 25, 2011
            ^ is alive and well in pro to signify a line start.

            > The leading "^" forces the pattern match to start in column 1 instead of
            > anywhere in the line (although I think Flo said it doesn't work in NTB Pro).
          • John Shotsky
            Yes, you re right. Years ago, I began my clip libraries with two clips that assure me that I don t need to remember about these issues. One is that I replace
            Message 5 of 12 , Jul 25, 2011
              Yes, you're right. Years ago, I began my clip libraries with two clips that assure me that I don't need to remember
              about these issues.

              One is that I replace \R with \r\n. That assures that there is only one kind of line end in my files.

              The other is that I replace \z with \r\n. That assures me that I have a blank line on the end of my file.

              Knowing these are non-issues up front, I have no need to make provisions for them elsewhere in the clip library. But I
              agree, for a random clip, such precautions are wise.

              Also I agree with Art that ^ should be used with the beginning of the find line. Otherwise, it could find 11_UID. ^
              works just fine in Pro � I use that and\or $ in most of my clips and my users use all three versions of NoteTab
              successfully with my clips.

              Regards,
              John

              From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Alec Burgess
              Sent: Monday, July 25, 2011 19:06
              To: ntb-clips@yahoogroups.com
              Subject: Re: [Clip] Delete lines of varying length that begin with a certain tag. Help?


              Just \R won't work if "1 _UID" appears on last line in file ... so ...
              (not tested ;-) )
              ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
              where \Z represents end-of-file or buffer

              On 2011-07-25 21:52, John Shotsky wrote:
              > The problem is with \$ which says you are looking for a $ in the file. Remove the slash and it will work. However, as
              > written, it will leave blank lines for each of them. To prevent the blank lines, use \R instead of $.
              >
              > Regards,
              > John
              >
              > From:ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> [mailto:ntb-clips@yahoogroups.com
              <mailto:ntb-clips%40yahoogroups.com> ] On Behalf Of Jane Peppler
              > Sent: Monday, July 25, 2011 18:05
              > To:ntb-Clips@yahoogroups.com <mailto:ntb-Clips%40yahoogroups.com>
              > Subject: [Clip] Delete lines of varying length that begin with a certain tag. Help?
              <snip>
              > 1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
              >
              > here's one of the (scores of) variations I tried - saved as a clip,
              > highlighted the whole file and pulled the trigger. Nada:
              >
              > ^!Replace "1 _UID .*\$">> "" rwais

              --
              Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)



              [Non-text portions of this message have been removed]
            • Jane Peppler
              It worked! Thank you all! Now, one more question - since I see some of these corrupted entries start with different numbers (ie 2 _UID or 3 _UID) what is the
              Message 6 of 12 , Jul 25, 2011
                It worked! Thank you all! Now, one more question - since I see some of
                these corrupted entries start with different numbers (ie 2 _UID or 3
                _UID) what is the proper wild card syntax? You are great to help me.
                Gratefully,
                Jane

                On 25 July 2011 22:41, John Shotsky <jshotsky@...> wrote:
                > Yes, you're right. Years ago, I began my clip libraries with two clips that assure me that I don't need to remember
                > about these issues.
                >
                > One is that I replace \R with \r\n. That assures that there is only one kind of line end in my files.
                >
                > The other is that I replace \z with \r\n. That assures me that I have a blank line on the end of my file.
                >
                > Knowing these are non-issues up front, I have no need to make provisions for them elsewhere in the clip library. But I
                > agree, for a random clip, such precautions are wise.
                >
                > Also I agree with Art that ^ should be used with the beginning of the find line. Otherwise, it could find 11_UID. ^
                > works just fine in Pro – I use that and\or $ in most of my clips and my users use all three versions of NoteTab
                > successfully with my clips.
                >
                > Regards,
                > John
                >
                > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Alec Burgess
                > Sent: Monday, July 25, 2011 19:06
                > To: ntb-clips@yahoogroups.com
                > Subject: Re: [Clip] Delete lines of varying length that begin with a certain tag. Help?
                >
                >
                > Just \R won't work if "1 _UID" appears on last line in file ... so ...
                > (not tested ;-) )
                > ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
                > where \Z represents end-of-file or buffer
                >
                > On 2011-07-25 21:52, John Shotsky wrote:
                >> The problem is with \$ which says you are looking for a $ in the file. Remove the slash and it will work. However, as
                >> written, it will leave blank lines for each of them. To prevent the blank lines, use \R instead of $.
                >>
                >> Regards,
                >> John
                >>
                >> From:ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>  [mailto:ntb-clips@yahoogroups.com
                > <mailto:ntb-clips%40yahoogroups.com> ] On Behalf Of Jane Peppler
                >> Sent: Monday, July 25, 2011 18:05
                >> To:ntb-Clips@yahoogroups.com <mailto:ntb-Clips%40yahoogroups.com>
                >> Subject: [Clip] Delete lines of varying length that begin with a certain tag. Help?
                > <snip>
                >> 1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
                >>
                >> here's one of the (scores of) variations I tried - saved as a clip,
                >> highlighted the whole file and pulled the trigger. Nada:
                >>
                >> ^!Replace "1 _UID .*\$">> "" rwais
                >
                > --
                > Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
                >
                >
                >
                > [Non-text portions of this message have been removed]
                >
                >
                >
                > ------------------------------------
                >
                > Fookes Software: http://www.fookes.com/
                > NoteTab website: http://www.notetab.com/
                > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                >
                > ***
                > Yahoo! Groups Links
                >
                >
                >
                >
              • Alec Burgess
                ... Then you said ... ... Jane: Based on time stamps of messages I m not sure which is last ... Assuming that what worked was this (or some variant of it):
                Message 7 of 12 , Jul 25, 2011
                  On 2011-07-25 22:08, Jane Peppler wrote:
                  > Argh, no, that did not work either! Thanks for trying though, both of you.
                  > Any other ideas? Jane
                  Then you said ...
                  > It worked! Thank you all! Now, one more question - since I see some of
                  > these corrupted entries start with different numbers (ie 2 _UID or 3
                  > _UID) what is the proper wild card syntax? You are great to help me.
                  Jane: Based on time stamps of messages I'm not sure which is last ...
                  Assuming that what worked was this (or some variant of it):
                  ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
                  then all you do is change initial "1" to "\d" (w/o quotes - means any
                  single digit) .... hence:
                  ^!Replace "^\d _UID .*(?:\$\Z)" >> "" rwais
                  (where I've added the leading ^ (means match only at beginning of line)
                  suggested by others.

                  I know that regular expression syntax can seem intimidating at first.
                  All of the [Help on Regular Expressions] (3rd entry down on Notetab-Help
                  is worth reading but I'd suggest first skimming first entry [Notetab and
                  PCRE] followed by 2nd last entry [PCRE Syntax Summary].

                  Bear in mind that some of the "stuff" described applies to programmers
                  who have direct access to PCRE internals (eg. Callouts and references to
                  PCRE functions such as pcre_dfa_exec() )

                  Hope this helps ... soon you will be providing help to others in this
                  group 8-)

                  Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)


                  > On 25 July 2011 22:05, Alec Burgess <buralex@...
                  > <mailto:buralex%40gmail.com>> wrote:
                  >
                  > > **
                  > >
                  > >
                  > > Just \R won't work if "1 _UID" appears on last line in file ... so ...
                  > > (not tested ;-) )
                  > > ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
                  > > where \Z represents end-of-file or buffer
                  > >
                  > >
                  > > On 2011-07-25 21:52, John Shotsky wrote:
                  > > > The problem is with \$ which says you are looking for a $ in the file.
                  > > Remove the slash and it will work. However, as
                  > > > written, it will leave blank lines for each of them. To prevent
                  > the blank
                  > > lines, use \R instead of $.
                  > > >
                  > > > Regards,
                  > > > John
                  > > >
                  > > > From:ntb-clips@yahoogroups.com
                  > <mailto:ntb-clips%40yahoogroups.com> [mailto:ntb-clips@yahoogroups.com
                  > <mailto:ntb-clips%40yahoogroups.com>] On
                  > > Behalf Of Jane Peppler
                  > > > Sent: Monday, July 25, 2011 18:05
                  > > > To:ntb-Clips@yahoogroups.com <mailto:ntb-Clips%40yahoogroups.com>
                  > > > Subject: [Clip] Delete lines of varying length that begin with a
                  > certain
                  > > tag. Help?
                  > > <snip>
                  > >
                  > > > 1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
                  > > >
                  > > > here's one of the (scores of) variations I tried - saved as a clip,
                  > > > highlighted the whole file and pulled the trigger. Nada:
                  > > >
                  > > > ^!Replace "1 _UID .*\$">> "" rwais
                  > >
                  > > --
                  > > Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
                  > >
                  > >
                  > >


                  [Non-text portions of this message have been removed]
                • Alec Burgess
                  Jane - OOPS! - I had typos in my first post and repeated them in my last; Following *IS* tested and (unless Yahoo garbles it) should work: ^!Replace ^ d _UID
                  Message 8 of 12 , Jul 25, 2011
                    Jane - OOPS! - I had typos in my first post and repeated them in my last;
                    Following *IS* tested and (unless Yahoo garbles it) should work:
                    ^!Replace "^\d _UID .*(?:\R|\Z)" >> "" rwais

                    On Tue, 26 Jul 2011 02:10:48 -0400 Alec Burgess
                    <buralex@...> said (in part):
                    > On 2011-07-25 22:08, Jane Peppler wrote:
                    >> Argh, no, that did not work either! Thanks for trying though, both of
                    >> you.
                    >> Any other ideas? Jane
                    > Then you said ...
                    >> It worked! Thank you all! Now, one more question - since I see some of
                    >> these corrupted entries start with different numbers (ie 2 _UID or 3
                    >> _UID) what is the proper wild card syntax? You are great to help me.
                    > Jane: Based on time stamps of messages I'm not sure which is last ...
                    > Assuming that what worked was this (or some variant of it):
                    > ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
                    > then all you do is change initial "1" to "\d" (w/o quotes - means any
                    > single digit) .... hence:
                    > ^!Replace "^\d _UID .*(?:\$\Z)" >> "" rwais
                    > (where I've added the leading ^ (means match only at beginning of
                    > line) suggested by others.
                    >
                    > I know that regular expression syntax can seem intimidating at first.
                    > All of the [Help on Regular Expressions] (3rd entry down on
                    > Notetab-Help is worth reading but I'd suggest first skimming first
                    > entry [Notetab and PCRE] followed by 2nd last entry [PCRE Syntax Summary].
                    >
                    > Bear in mind that some of the "stuff" described applies to programmers
                    > who have direct access to PCRE internals (eg. Callouts and references
                    > to PCRE functions such as pcre_dfa_exec() )
                    >
                    > Hope this helps ... soon you will be providing help to others in this
                    > group 8-)
                    > Regards ... Alec (buralex@gmail& WinLiveMess - alec.m.burgess@skype)
                    >
                    >> On 25 July 2011 22:05, Alec Burgess <buralex@...
                    >> <mailto:buralex%40gmail.com>> wrote:
                    >>
                    >> > **
                    >> >
                    >> >
                    >> > Just \R won't work if "1 _UID" appears on last line in file ... so ...
                    >> > (not tested ;-) )
                    >> > ^!Replace "1 _UID .*(?:\$\Z)" >> "" rwais
                    >> > where \Z represents end-of-file or buffer
                    >> >
                    >> >
                    >> > On 2011-07-25 21:52, John Shotsky wrote:
                    >> > > The problem is with \$ which says you are looking for a $ in the
                    >> file.
                    >> > Remove the slash and it will work. However, as
                    >> > > written, it will leave blank lines for each of them. To prevent
                    >> the blank
                    >> > lines, use \R instead of $.
                    >> > >
                    >> > > Regards,
                    >> > > John
                    >> > >
                    >> > > From:ntb-clips@yahoogroups.com
                    >> <mailto:ntb-clips%40yahoogroups.com>
                    >> [mailto:ntb-clips@yahoogroups.com
                    >> <mailto:ntb-clips%40yahoogroups.com>] On
                    >> > Behalf Of Jane Peppler
                    >> > > Sent: Monday, July 25, 2011 18:05
                    >> > > To:ntb-Clips@yahoogroups.com <mailto:ntb-Clips%40yahoogroups.com>
                    >> > > Subject: [Clip] Delete lines of varying length that begin with a
                    >> certain
                    >> > tag. Help?
                    >> > <snip>
                    >> >
                    >> > > 1 _UID 6E58E0BD-56B3-4861-9310-EDB94FC9B9AA
                    >> > >
                    >> > > here's one of the (scores of) variations I tried - saved as a clip,
                    >> > > highlighted the whole file and pulled the trigger. Nada:
                    >> > >
                    >> > > ^!Replace "1 _UID .*\$">> "" rwais
                    >> >
                    >> > --
                    >> > Regards ... Alec (buralex@gmail & WinLiveMess - alec.m.burgess@skype)
                    >> >
                    >> >
                    >> >


                    [Non-text portions of this message have been removed]
                  • flo.gehrke
                    ... Art, No, I wouldn t say that. I suspect that s a misunderstanding that goes back to topic #21534 of 02/17/2011. The issue, in that case, was not ^ but
                    Message 9 of 12 , Jul 26, 2011
                      --- In ntb-clips@yahoogroups.com, Art Kocsis <artkns@...> wrote:
                      >
                      > The leading "^" forces the pattern match to start in column 1
                      > instead of anywhere in the line (although I think Flo said it
                      > doesn't work in NTB Pro).

                      Art,

                      No, I wouldn't say that. I suspect that's a misunderstanding that goes back to topic #21534 of 02/17/2011. The issue, in that case, was not '^' but the '{0,}' or '*' quantifier causing problems at the beginning of a line.

                      Nevertheless, we see different issues with '^' but they do not pertain to the context of the topic that is discussed here.

                      Regards,
                      Flo
                    Your message has been successfully submitted and would be delivered to recipients shortly.