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

How to remove lines

Expand Messages
  • C
    Hi friends, With regex, how I remove (from a list of 1000 lines) all lines that include the word toremove in the of a line? I know, it is a stupid question,
    Message 1 of 7 , Nov 3, 2011
      Hi friends,

      With regex, how I remove (from a list of 1000 lines) all lines that include the word "toremove" in the of a line?

      I know, it is a stupid question, but I dont know how.

      Thanks!
    • Don
      ^!Replace ^.*toremove.* R RAWS
      Message 2 of 7 , Nov 3, 2011
        ^!Replace "^.*toremove.*\R" >> "" RAWS


        On 11/3/2011 2:33 PM, C wrote:
        > Hi friends,
        >
        > With regex, how I remove (from a list of 1000 lines) all lines that include the word "toremove" in the of a line?
        >
        > I know, it is a stupid question, but I dont know how.
        >
        > Thanks!
      • Axel Berger
        ... Not really. I know Diodeom s solution will be more elgant, but this one is as primitive and understandable as it gets: ^!Replace R.*(toremove).* R
        Message 3 of 7 , Nov 3, 2011
          C wrote:
          > how I remove (from a list of 1000 lines) all lines that include
          > the word "toremove" in the of a line?
          > I know, it is a stupid question, but I dont know how.

          Not really. I know Diodeom's solution will be more elgant, but this one
          is as primitive and understandable as it gets:

          ^!Replace "\R.*(toremove).*\R" >> "\n" WRASTI

          This is untested but ought to work. For some inexplicable reason writing
          \r\n has sometimes resulted in two newlines here, no idea why, it
          oughtn't, so I just put \n and the result is always fine. N:B: The
          braces fulfil no function but making the term more legible.

          Axel

          --
          Dipl.-Ing. F. Axel Berger Tel: +49/ 2174/ 7439 07
          Johann-Häck-Str. 14 Fax: +49/ 2174/ 7439 68
          D-51519 Odenthal-Heide eMail: Axel-Berger@...
          Deutschland (Germany) http://berger-odenthal.de
        • C
          Friend Axel, Hi, Is because the group do not accept words like that (exclude the spaces): ^ ord °etc. Thanks for all friends! Thanks!
          Message 4 of 7 , Nov 4, 2011
            Friend Axel,

            Hi,

            Is because the group do not accept words like that (exclude the spaces):

            ^ ord °etc.

            Thanks for all friends!

            Thanks!
            ---------------------------

            --- In ntb-clips@yahoogroups.com, "C" <backup2abet@...> wrote:
            >
            > Hi friends,
            >
            > With regex, how I remove (from a list of 1000 lines) all lines that include the word "toremove" in the of a line?
            >
            > I know, it is a stupid question, but I dont know how.
            >
            > Thanks!
            >
          • m_frascinella
            Don, I generalized on your example, so the following lines let you enter the search string and away it goes. I ran a simple test and it works. ^!Set
            Message 5 of 7 , Nov 8, 2011
              Don,

              I generalized on your example, so the following lines let you enter the search string and away it goes. I ran a simple test and it works.

              ^!Set %Searchstring%=^?{Enter text to search for:}
              ^!Replace "^.*(^%Searchstring%).*\R" >> "" RAWS


              Yours,

              Michael F
              =========

              --- In ntb-clips@yahoogroups.com, Don <don@...> wrote:
              >
              > ^!Replace "^.*toremove.*\R" >> "" RAWS
              >
            • Don
              precisely how I do it -- in my dialog for the set I say use regex and pipe for alternates so I realize I can use RegEx syntax. Cool stuff! Love NoteTab!
              Message 6 of 7 , Nov 8, 2011
                precisely how I do it -- in my dialog for the set I say "use regex and
                pipe for alternates" so I realize I can use RegEx syntax.

                Cool stuff! Love NoteTab! Thanks Eric (and Jody).

                On 11/8/2011 9:07 AM, m_frascinella wrote:
                > Don,
                >
                > I generalized on your example, so the following lines let you enter the search string and away it goes. I ran a simple test and it works.
                >
                > ^!Set %Searchstring%=^?{Enter text to search for:}
                > ^!Replace "^.*(^%Searchstring%).*\R" >> "" RAWS
                >
                >
                > Yours,
                >
                > Michael F
              • lynn4166
                I just tried this and it worked great except it didn t delete the lines where the word wasn t at the end of the line. Is there a way to modify it to make it
                Message 7 of 7 , Nov 21, 2011
                  I just tried this and it worked great except it didn't delete the lines where the word wasn't at the end of the line. Is there a way to modify it to make it work no matter where the search string is within the line?

                  Sincerely,
                  Terescia

                  --- In ntb-clips@yahoogroups.com, "m_frascinella" <mfrascinella@...> wrote:
                  >
                  > Don,
                  >
                  > I generalized on your example, so the following lines let you enter the search string and away it goes. I ran a simple test and it works.
                  >
                  > ^!Set %Searchstring%=^?{Enter text to search for:}
                  > ^!Replace "^.*(^%Searchstring%).*\R" >> "" RAWS
                  >
                  >
                  > Yours,
                  >
                  > Michael F
                  > =========
                  >
                  > --- In ntb-clips@yahoogroups.com, Don <don@> wrote:
                  > >
                  > > ^!Replace "^.*toremove.*\R" >> "" RAWS
                  > >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.