🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #2863

Re: Counting and appending an integer in VI?

#2863
From: Hans Mulder
Date: Wed, 26 Jun 1991 13:05
40 lines
1047 bytes
In <1991Jun26.031232.29957@massey.ac.nz> R.Singh@massey.ac.nz (R. Singh) writes:

)Assume a file with 10 foxes.

)foxes
)foxes
)foxes
)foxes
)foxes
)foxes
)foxes
)foxes
)foxes
)foxes

)I want to change it to

)foxes1
)foxes2
)foxes3
)foxes4
)foxes5
)foxes6
)foxes7
)foxes8
)foxes9
)foxes10

)Is it possible in VI.

No.  You'll have to use an external filter, e.g.

1G!G awk '{print $0 NR}'

Change the 1G!G bit to taste (and the awk program for that matter).

--
Have a nice day,

Hans Mulder	hansm@cs.kun.nl
Technical Details
Message-ID: <3707@wn1.sci.kun.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!mcsun!hp4nl!sci.kun.nl!cs.kun.nl!hansm
References: <1991Jun26.031232.29957@massey.ac.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!mcsun!hp4nl!sci.kun.nl!cs.kun.nl!hansm
From: hansm@cs.kun.nl (Hans Mulder)
Newsgroups: comp.editors
Subject: Re: Counting and appending an integer in VI?
Message-ID: <3707@wn1.sci.kun.nl>
Date: 26 Jun 91 13:05:36 GMT
Article-I.D.: wn1.3707
References: <1991Jun26.031232.29957@massey.ac.nz>
Sender: root@sci.kun.nl
Organization: University of Nijmegen, The Netherlands
Lines: 40