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

How to search a "path" string in a file?

Expand Messages
  • Jerry Dai
    Hi, I have a file with a lot of path in it. I want to search /home/user/bin/session.log without changing / to / . How should I do it? Thanks. -- -- Best
    Message 1 of 5 , Jan 31, 2012
    • 0 Attachment
      Hi,

      I have a file with a lot of path in it. I want to search "/home/user/bin/session.log" without changing  "/" to "\/".
      How should I do it?

      Thanks.
       
      -- --
      Best Regards
      Jerry Dai

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Christian Brabandt
      Hi Jerry! ... You can at least use ? to search backwards, which does not care about / delimiting the pattern, or if you have at least a normal built, you can
      Message 2 of 5 , Jan 31, 2012
      • 0 Attachment
        Hi Jerry!

        On Di, 31 Jan 2012, Jerry Dai wrote:

        > Hi,
        >
        > I have a file with a lot of path in it. I want to search
        > "/home/user/bin/session.log" without changing "/" to "\/".
        > How should I do it?

        You can at least use ? to search backwards, which does not care about /
        delimiting the pattern, or if you have at least a normal built, you can
        simply paste the pattern into the search register:
        :let @/='/home/user/bin/session.log'
        and press n.

        I should possibly put this into the faq.

        regards,
        Christian
        --
        Ungläubiger:
        In New York: Jemand, der nicht an die christliche Religion glaubt.
        In Istanbul: Jemand, der an sie glaubt.
        -- Ambrose Gwinnet Bierce (Des Teufels Wörterbuch)

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Gary Johnson
        ... The easiest way is probably to begin a reverse search by typing ? followed by your path. If you want to change that to a forward search, simply type /
        Message 3 of 5 , Jan 31, 2012
        • 0 Attachment
          On 2012-01-31, Jerry Dai wrote:
          > Hi,
          >
          > I have a file with a lot of path in it. I want to search "/home/user/bin/
          > session.log" without changing "/" to "\/".
          > How should I do it?

          The easiest way is probably to begin a reverse search by typing '?'
          followed by your path. If you want to change that to a forward
          search, simply type '/' and Enter.

          Regards,
          Gary

          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • ji fei
          May be :s#/home/user/bin/session.log#& can do this. ... -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the
          Message 4 of 5 , Jan 31, 2012
          • 0 Attachment
            May be :s#/home/user/bin/session.log#& can do this.

            On Wed, Feb 1, 2012 at 2:37 AM, Gary Johnson <garyjohn@...> wrote:
            On 2012-01-31, Jerry Dai wrote:
            > Hi,
            >
            > I have a file with a lot of path in it. I want to search "/home/user/bin/
            > session.log" without changing  "/" to "\/".
            > How should I do it?

            The easiest way is probably to begin a reverse search by typing '?'
            followed by your path.  If you want to change that to a forward
            search, simply type '/' and Enter.

            Regards,
            Gary

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Jerry Dai
            Thanks. This works perfectly! -- -- Best Regards Jerry Dai ... -- You received this message from the vim_use maillist. Do not top-post! Type your reply below
            Message 5 of 5 , Feb 1, 2012
            • 0 Attachment
              Thanks.
              This works perfectly!
               
              -- --
              Best Regards
              Jerry Dai



              On Tue, Jan 31, 2012 at 10:37 AM, Gary Johnson <garyjohn@...> wrote:
              On 2012-01-31, Jerry Dai wrote:
              > Hi,
              >
              > I have a file with a lot of path in it. I want to search "/home/user/bin/
              > session.log" without changing  "/" to "\/".
              > How should I do it?

              The easiest way is probably to begin a reverse search by typing '?'
              followed by your path.  If you want to change that to a forward
              search, simply type '/' and Enter.

              Regards,
              Gary

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            Your message has been successfully submitted and would be delivered to recipients shortly.