[comp.editors] Vi bashing or counting lines

schmauss@lan.informatik.tu-muenchen.dbp.de (Franz Schmausser) (04/11/89)

In article <175@hcr.UUCP> stacey@hcrvax.UUCP (Stacey Campbell) writes:
>In article <4129@ttidca.TTI.COM> kevin@ttidcb.tti.com (Kevin Carothers) writes:
>
>The original question by the beginner user was "I want to delete lines
>in vi, but I need to know an easy way to count the lines for deletion?"
>This implies that user knew only one way to delete lines in vi, namely
>
>	[integer]dd
>
>So you, my extremely misguided friend, offer;
>
>	'a,'bw! wc -l

Are YOU all joking ???
It's easy to count lines in vi without forking any subprocesses:

	'ay'b

and vi reports:

	... lines yanked
		

The report variable should be set to a small value (:set report=2)

>
>to achieve the calculation of the integer.  This amounts to a
>minimum of two execs and one fork (more likely two) to count
>a range of marked lines so that a value can be prefixed to dd.
>
>Obviously an extremely expensive and stupid way to delete lines.
>

As always RTFM ...

.------------------------------------------------------------------------------.
|  Franz "Oin" Schmausser             local: lan.informatik.tu-muenchen.dbp.de |
|  TU Muenchen, Inst. f. Informatik     DFN: schmauss@{local}                  |
|  Arcisstrasse                        UUCP: schmauss%{local}@unido.uucp       |
|  D-8000 Muenchen                  ARPA/CS: schmauss%{local}@relay.cs.net     |
`------------------------------------------------------------------------------'