🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #2858

Re: Counting and appending an integer in VI?

#2858
From: Tom Christiansen
Date: Wed, 26 Jun 1991 11:36
44 lines
1231 bytes
From the keyboard of R.Singh@massey.ac.nz (R. Singh):
|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.

All things are possible; not all are expedient.  For both, try this:

:%!perl -pe 's/$/$./'

or this.

:%!awk '{print $0 NR}'

or whatever.  I dare say even nroff filters are possible, but then 
we're probably straying a bit from expediency. :-)

--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
		"So much mail, so little time."  
Technical Details
Message-ID: <1991Jun26.113611.1625@convex.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!convex!usenet
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!usc!cs.utexas.edu!uunet!convex!usenet
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.editors
Subject: Re: Counting and appending an integer in VI?
Message-ID: <1991Jun26.113611.1625@convex.com>
Date: 26 Jun 91 11:36:11 GMT
References: <1991Jun26.031232.29957@massey.ac.nz>
Sender: usenet@convex.com (news access account)
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Software Development, Richardson, TX
Lines: 44
Nntp-Posting-Host: pixel.convex.com