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

Re: Multi-dimensional line numbers

Expand Messages
  • A. S. Budden
    ... I m not sure exactly what you re trying to achieve, but the thoughts I ve had on this are: * If you just want line numbering down the side, vsplit the
    Message 1 of 5 , Sep 9, 2008
    • 0 Attachment
      2008/9/9 Pankaj Deshpande <pankaj.deshpande@...>:
      >
      > Hello,
      > In a very large file, with say tens of thousands or sometimes even hundreds of thousands of lines with repetitive contents, is it possible to address a line with two (or more) numbers?
      >
      > To elaborate my file could have 10000 lines. There could be five parts in my file each with more or less than 2000 lines. I may want to count the lines associated with first part (with say,1732 lines) as (1, 1..1732) and second part with say 2342 lines as (2, 1..2342).
      >
      > If someone is aware of such line addressing please reply.

      I'm not sure exactly what you're trying to achieve, but the thoughts
      I've had on this are:

      * If you just want line numbering down the side, vsplit the window and
      (auto)populate it with the numbers you want and then use scrollbind to
      link the pages together

      * If you just want to address the lines in (e.g.) a substitute
      command, you could use something like:

      :0;/search-for-first-line-in-range/+lineNum,/search-for-first-line-in-range/+lineNum2s/from/to

      e.g. If the file contains

      FIRST
      The
      The
      The
      SECOND
      The
      The
      The

      and you want to change the second 'The' of the 'SECOND' set to 'It',
      you could use:

      :0;/SECOND/+2,/SECOND/+2s/The/It

      Hope that helps

      Al

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    Your message has been successfully submitted and would be delivered to recipients shortly.