Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.linux > #59155

Adding line numbers to vi (or vim) file of data

From Guadalupe <Guadalupe@Guadalupe.com>
Newsgroups alt.os.linux
Subject Adding line numbers to vi (or vim) file of data
Date 2019-10-06 13:17 -0400
Organization Aioe.org NNTP Server
Message-ID <qnd7jr$i69$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Given I have a file of about 100 lines, I just want line numbers in front
of each line.

If I use ":set number" in vi, I see EXACTLY what I want but I can't copy
and paste the result to create a text file that has actual numbers for each
item.

Googling for how to insert a sequence of numbers from 1 to 100, one in
front of each line, I find plenty of stuff that simply numbers an empty
file such as these
https://vim.fandom.com/wiki/Generating_a_column_of_increasing_numbers
https://stackoverflow.com/questions/9903660/vi-how-to-generate-a-number-sequence
https://vim.fandom.com/wiki/Making_a_list_of_numbers

But I don't want to "make a list of sequential numbers".
I want to number the list of lines that I already have.

Any ideas?

Back to alt.os.linux | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Adding line numbers to vi (or vim) file of data Guadalupe <Guadalupe@Guadalupe.com> - 2019-10-06 13:17 -0400
  Re: Adding line numbers to vi (or vim) file of data Paul <nospam@needed.invalid> - 2019-10-06 14:04 -0400
    Re: Adding line numbers to vi (or vim) file of data Guadalupe <Guadalupe@Guadalupe.com> - 2019-10-06 18:16 -0400
  Re: Adding line numbers to vi (or vim) file of data Chris Elvidge <chris@mshome.net> - 2019-10-06 19:58 +0100
  Re: Adding line numbers to vi (or vim) file of data Jasen Betts <jasen@xnet.co.nz> - 2019-10-07 08:12 +0000
    Re: Adding line numbers to vi (or vim) file of data gazelle@shell.xmission.com (Kenny McCormack) - 2019-10-07 12:32 +0000
      Re: Adding line numbers to vi (or vim) file of data Guadalupe <Guadalupe@Guadalupe.com> - 2019-10-07 09:56 -0400
        Re: Adding line numbers to vi (or vim) file of data gazelle@shell.xmission.com (Kenny McCormack) - 2019-10-07 14:31 +0000
  Re: Adding line numbers to vi (or vim) file of data Dan Purgert <dan@djph.net> - 2019-10-07 10:16 +0000
  Re: Adding line numbers to vi (or vim) file of data Real Troll <real.troll@trolls.com> - 2019-10-07 09:59 -0400
  Re: Adding line numbers to vi (or vim) file of data marrgol <marrgol@address.invalid> - 2019-10-07 16:25 +0200
    Re: Adding line numbers to vi (or vim) file of data Guadalupe <Guadalupe@Guadalupe.com> - 2019-10-07 13:08 -0400

csiph-web