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

bufdo g/pattern/p fails

Expand Messages
  • andalou@katamail.com
    If I apply :bufdo g/Studio/p to the files hola1.htm, hola2.htm, it finds only 2 lines instead of the 3 lines which contain the pattern. hola1.htm ...
    Message 1 of 3 , Nov 3, 2004
      If I apply ":bufdo g/Studio/p" to the files hola1.htm, hola2.htm, it finds only 2 lines instead of the 3 lines which contain the pattern.

      hola1.htm
      --------------
      <html>

      <head>
      <title>La Sorgente</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <meta name="author" content="Studio Freak">
      <meta name="copyright" content="interphoto@...">
      <meta name='description' content='La Sorgente - Disclaimer'>

      <style type='text/css'>
      <!--
      body { background:#FFFFFF; font-family:'verdana,arial,helvetica'; color:#000000; }
      dt { font-size:12pt; font-weight:bold; color:#FF0000; }
      dd { font-size:10pt; text-align:justify; }
      a { font-weight:bold; text-decoration:underline; color:#FF00FF; }
      a:hover { color:#FF0000; }
      -->
      </style>
      </head>

      <body>
      <small>Design and Engineering by <a href="http://www.studiofreak.com" target="_blank">Studio Freak</a></small>
      </body>

      </html>
      -------------------------------------------------------------------------------

      hola2.htm
      --------------
      <html>

      <head>
      <title>La Sorgente</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
      <meta name="author" content="Studio Freak">
      <meta name="copyright" content="interphoto@...">

      <style type='text/css'>
      <!--
      body { background:#FFFFFF; font-family:'verdana,arial,helvetica'; color:#000000; }
      dt { font-size:12pt; font-weight:bold; color:#FF0000; }
      dd { font-size:10pt; text-align:justify; }
      a { font-weight:bold; text-decoration:underline; color:#FF00FF; }
      a:hover { color:#FF0000; }
      -->
      </style>
      </head>

      <body>
      Ésta es otra página
      </body>
      </html>
      ------------------------------------------------------------------------------------------

      Thanks in advance

      Cesar

      ________________________________________________________________________
      Cerchi un laboratorio fotografico aperto 24 ore su 24?
      Stampa le tue foto digitali su Kataweb e le ricevi a domicilio in 48 ore.
      http://www.kataweb.it/foto
    • Tim Chase
      ... It looks like vim is finding them all, just painting the file info text over top of it. If you try ... you ll see it find all three lines, but as soon as
      Message 2 of 3 , Nov 3, 2004
        > If I apply ":bufdo g/Studio/p" to the files hola1.htm,
        > hola2.htm, it finds only 2 lines instead of the 3 lines which
        > contain the pattern.

        It looks like vim is finding them all, just painting the file
        info text over top of it. If you try

        :bufdo g/Studio/p | sleep 2

        you'll see it find all three lines, but as soon as it hits the
        2nd buffer, it overwrites the 2nd find (on line 22, rather than
        the one on line 6) with the file info for the second file.

        Some workarounds that occur to me:

        :bufdo g/Studio/p | echo

        seems to work for me. Or you can yank the results into a
        register and then paste that into another window:

        :let @a=''
        :bufdo g/Studio/y A
        :new
        "aP

        I don't know if this is a redraw bug, or just a bit of quirky
        behavior, but it doesn't quite seem to produce what's expected.

        -tim
      • Hari Krishna Dara
        ... only 2 lines instead of the 3 lines which contain the pattern. ... color:#000000; } ... target= _blank Studio Freak ... color:#000000; } ...
        Message 3 of 3 , Nov 3, 2004
          On Wed, 3 Nov 2004 at 6:21pm, andalou@... wrote:

          > If I apply ":bufdo g/Studio/p" to the files hola1.htm, hola2.htm, it finds
          only 2 lines instead of the 3 lines which contain the pattern.
          >
          > hola1.htm
          > --------------
          > <html>
          >
          > <head>
          > <title>La Sorgente</title>
          > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
          > <meta name="author" content="Studio Freak">
          > <meta name="copyright" content="interphoto@...">
          > <meta name='description' content='La Sorgente - Disclaimer'>
          >
          > <style type='text/css'>
          > <!--
          > body { background:#FFFFFF; font-family:'verdana,arial,helvetica';
          color:#000000; }
          > dt { font-size:12pt; font-weight:bold; color:#FF0000; }
          > dd { font-size:10pt; text-align:justify; }
          > a { font-weight:bold; text-decoration:underline; color:#FF00FF; }
          > a:hover { color:#FF0000; }
          > -->
          > </style>
          > </head>
          >
          > <body>
          > <small>Design and Engineering by <a href="http://www.studiofreak.com"
          target="_blank">Studio Freak</a></small>
          > </body>
          >
          > </html>
          >
          -------------------------------------------------------------------------------
          >
          > hola2.htm
          > --------------
          > <html>
          >
          > <head>
          > <title>La Sorgente</title>
          > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
          > <meta name="author" content="Studio Freak">
          > <meta name="copyright" content="interphoto@...">
          >
          > <style type='text/css'>
          > <!--
          > body { background:#FFFFFF; font-family:'verdana,arial,helvetica';
          color:#000000; }
          > dt { font-size:12pt; font-weight:bold; color:#FF0000; }
          > dd { font-size:10pt; text-align:justify; }
          > a { font-weight:bold; text-decoration:underline; color:#FF00FF; }
          > a:hover { color:#FF0000; }
          > -->
          > </style>
          > </head>
          >
          > <body>
          > Ésta es otra página
          > </body>
          > </html>
          >
          ------------------------------------------------------------------------------------------
          >
          > Thanks in advance
          >
          > Cesar

          Vim is finding all the hits, but the message that comes up while loading
          a new buffer overwrites the last hit in the previous buffer. I found the
          same issue a few weeks back while I was creating the :BufGrep command
          for my greputils.vim plugin (and reported it too). In any case, since it
          is only a redraw issue, you will be fine if you redirect the output to a
          register. I suggest you to take a look at the :BufGrep command and its
          cousines in my greputils.vim plugin to execute g/pattern/p commands. The
          plugin does the work for you to redirect the output, filter the
          unnecessary messages and present you the result in a quick-fix-like
          window.

          http://www.vim.org/script.php?script_id=1062

          --
          HTH,
          Hari



          __________________________________
          Do you Yahoo!?
          Check out the new Yahoo! Front Page.
          www.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.