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

Re: Remove all lines containing specific pattern

Expand Messages
  • Gary Johnson
    ... Others have already mentioned the relevant help entries. Gary -- Gary Johnson | Agilent Technologies garyjohn@spk.agilent.com |
    Message 1 of 7 , Jul 2, 2003
    View Source
    • 0 Attachment
      On 2003-07-02, Mike Wang <BzbJen@...> wrote:
      > Hi,
      >
      > I have a data file with several thousand lines but only wish to
      > keep any line that has a specific pattern, say, "SWITCH1". Is it
      > possible to open the file and have vim delete all the lines
      > without a specific pattern?

      :v/SWITCH1/d

      Others have already mentioned the relevant help entries.

      Gary

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Wireless Division
      | Spokane, Washington, USA
    • Keith Roberts
      And how would one normally run into this usr_27.txt??? That stuff would have been handy for me any number of times, but I ve never seen a reference to it
      Message 2 of 7 , Jul 3, 2003
      View Source
      • 0 Attachment
        And how would one normally run into this usr_27.txt???

        That stuff would have been handy for me any number of times, but I've never
        seen a reference to it before.

        There are no tags in it which would be found by :h regex, :ta /regex (or
        "search" instead of "regex".

        I did a :helpgrep regex, but that gives 107 references, too many to check
        (and it's not even in that file anyway.

        :helpgrep search yields 1060 references, WAY too many to wade thru.


        -----Original Message-----
        From: Geoffrey Mann [mailto:Geoffrey.Mann@...]
        Sent: Wednesday, July 02, 2003 11:49 AM
        To: Mike Wang; vim@...
        Subject: RE: Remove all lines containing specific pattern


        Hi Mike,

        try:

        :h regexp
        :h usr_27.txt

        hth

        -----Original Message-----
        From: Mike Wang [mailto:BzbJen@...]
        Sent: Wednesday, July 02, 2003 3:48 PM
        To: vim@...
        Subject: Remove all lines containing specific pattern


        Hi,

        I have a data file with several thousand lines but only wish to keep any
        line that has a specific pattern, say, "SWITCH1". Is it possible to open
        the file and have vim delete all the lines without a specific pattern?

        Also, is there a help txt that comes with vim that I can read up to do such
        filtering or pattern matching/replacing?

        Thanks,

        Mike

        __________________________________________________________________
        McAfee VirusScan Online from the Netscape Network.
        Comprehensive protection for your entire computer. Get your free trial
        today!
        http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

        Get AOL Instant Messenger 5.1 free of charge. Download Now!
        http://aim.aol.com/aimnew/Aim/register.adp?promo=380455
      • Shaun Jackman
        The table-of-contents is a good reference on occasion. When you re too used to indexes, it s easy to forget about. ... /Search n Cheers, Shaun
        Message 3 of 7 , Jul 3, 2003
        View Source
        • 0 Attachment
          The table-of-contents is a good reference on occasion. When you're too
          used to indexes, it's easy to forget about.

          :help
          /Search
          n

          Cheers,
          Shaun


          On Thu, 2003-07-03 at 11:29, Keith Roberts wrote:
          > And how would one normally run into this usr_27.txt???
          >
          > That stuff would have been handy for me any number of times, but I've never
          > seen a reference to it before.
          >
          > There are no tags in it which would be found by :h regex, :ta /regex (or
          > "search" instead of "regex".
          >
          > I did a :helpgrep regex, but that gives 107 references, too many to check
          > (and it's not even in that file anyway.
          >
          > :helpgrep search yields 1060 references, WAY too many to wade thru.
        • Keith Roberts
          Lookit that! Can t remember the last time I looked at that file; back at 5.9 at least. You re a scholar and a gentleman! :) TYVM ... From: Shaun Jackman
          Message 4 of 7 , Jul 3, 2003
          View Source
          • 0 Attachment
            Lookit that! Can't remember the last time I looked at that file; back at
            5.9 at least.

            You're a scholar and a gentleman! :)

            TYVM


            -----Original Message-----
            From: Shaun Jackman [mailto:sjackman@...]
            Sent: Thursday, July 03, 2003 9:51 AM
            To: Keith Roberts
            Cc: vim@...
            Subject: RE: Remove all lines containing specific pattern

            The table-of-contents is a good reference on occasion. When you're too
            used to indexes, it's easy to forget about.

            :help
            /Search
            n

            Cheers,
            Shaun


            On Thu, 2003-07-03 at 11:29, Keith Roberts wrote:
            > And how would one normally run into this usr_27.txt???
            >
            > That stuff would have been handy for me any number of times, but I've
            never
            > seen a reference to it before.
            >
            > There are no tags in it which would be found by :h regex, :ta /regex (or
            > "search" instead of "regex".
            >
            > I did a :helpgrep regex, but that gives 107 references, too many to check
            > (and it's not even in that file anyway.
            >
            > :helpgrep search yields 1060 references, WAY too many to wade thru.
          Your message has been successfully submitted and would be delivered to recipients shortly.