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

argdo and grep

Expand Messages
  • Naim Far
    Hi Vimers, I was wondering about argdo! Is there anyway to do the following command ... I tried it but it didn t work, I tried some few others ways, but they
    Message 1 of 4 , Mar 1, 2007
    View Source
    • 0 Attachment
      Hi Vimers,


      I was wondering about argdo! Is there anyway to do the following
      command

      :grep <pattern> * | argdo :%s/<pattern>/<new_pattern>/g

      I tried it but it didn't work, I tried some few others ways, but they
      didn't work either

      Thanx...
    • Yakov Lerner
      ... How about this: vim `grep -l pattern *` ... Yakov
      Message 2 of 4 , Mar 1, 2007
      View Source
      • 0 Attachment
        On 3/1/07, Naim Far <naim@...> wrote:
        > I was wondering about argdo! Is there anyway to do the following
        > command
        >
        > :grep <pattern> * | argdo :%s/<pattern>/<new_pattern>/g

        How about this:
        vim `grep -l 'pattern' *`
        :argdo :%s/<pattern>/<new_pattern>/g

        Yakov
      • Naim Far
        Thanx Yakov for your response, It would help, but I would rather to do it with in working in vim. I m editing an enormous number of files, and when I change a
        Message 3 of 4 , Mar 1, 2007
        View Source
        • 0 Attachment
          Thanx Yakov for your response,

          It would help, but I would rather to do it with in working in vim. I'm
          editing an enormous number of files, and when I change a pattern, I want
          to change it in the few files that has this pattern, and not having to
          go through all the files.

          Is there anyway you could think of?!


          Thanx again...

          Naim


          -----Original Message-----
          From: Yakov Lerner [mailto:iler.ml@...]
          Sent: Thursday, March 01, 2007 2:20 PM
          To: Naim Far
          Cc: vim@...
          Subject: Re: argdo and grep

          On 3/1/07, Naim Far <naim@...> wrote:
          > I was wondering about argdo! Is there anyway to do the following
          > command
          >
          > :grep <pattern> * | argdo :%s/<pattern>/<new_pattern>/g

          How about this:
          vim `grep -l 'pattern' *`
          :argdo :%s/<pattern>/<new_pattern>/g

          Yakov
        • Hari Krishna Dara
          ... You will have to make sure hidden is set or tack on | w at the end. -- HTH, Hari ...
          Message 4 of 4 , Mar 1, 2007
          View Source
          • 0 Attachment
            On Thu, 1 Mar 2007 at 5:25pm, Naim Far wrote:

            > Thanx Yakov for your response,
            >
            > It would help, but I would rather to do it with in working in vim. I'm
            > editing an enormous number of files, and when I change a pattern, I want
            > to change it in the few files that has this pattern, and not having to
            > go through all the files.
            >
            > Is there anyway you could think of?!

            Try:

            :args `grep -l 'pattern' *` | argdo :%s/<pattern>/<new_pattern>/g

            You will have to make sure 'hidden' is set or tack on "| w" at the end.

            --
            HTH,
            Hari

            >
            > Thanx again...
            >
            > Naim
            >
            >
            > -----Original Message-----
            > From: Yakov Lerner [mailto:iler.ml@...]
            > Sent: Thursday, March 01, 2007 2:20 PM
            > To: Naim Far
            > Cc: vim@...
            > Subject: Re: argdo and grep
            >
            > On 3/1/07, Naim Far <naim@...> wrote:
            > > I was wondering about argdo! Is there anyway to do the following
            > > command
            > >
            > > :grep <pattern> * | argdo :%s/<pattern>/<new_pattern>/g
            >
            > How about this:
            > vim `grep -l 'pattern' *`
            > :argdo :%s/<pattern>/<new_pattern>/g
            >
            > Yakov
            >
            >



            ____________________________________________________________________________________
            8:00? 8:25? 8:40? Find a flick in no time
            with the Yahoo! Search movie showtime shortcut.
            http://tools.search.yahoo.com/shortcuts/#news
          Your message has been successfully submitted and would be delivered to recipients shortly.