How to add line numbers to a text file?

Dennis Davis ccsdhd at gdt.bath.ac.uk
Fri Dec 7 01:43:54 AEST 1990


Newsgroups: comp.unix.questions
Subject: Re: How to add line numbers to a text file?
Summary: 
Expires: 
References: <15248:Nov3018:01:4490 at kramden.acf.nyu.edu> <rhoward.659993691 at romeo> <18438:Nov3021:25:2590 at kramden.acf.nyu.edu>
Sender: 
Followup-To: 
Distribution: 
Organization: Bath University Computing Services, Bath, England
Keywords: 

In article <18438:Nov3021:25:2590 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
     .
     .
     .
>(Yeah, that's it: echo 'set nu' >> ~/.exinit. :-) )
>
>---Dan

Nice to see someone suggesting the use of my favourite editor :-)

However it isn't necessary to modify your .exrc startup file.  A
command line of the form:

ex - -R +'set nu|1,$p|q' filename

should suffice.

Yes, I know it suffers from the disadvantages of

  (a) Being slow and inefficient.
  (b) Will only handle a limited size of file.
  (c) You can't tailor the output.

but, what the heck, it's different :-)
-- 
Dennis Davis            JANET: D.H.Davis at UK.AC.BATH
University of Bath       UUCP: ...!mcsun!ukc!gdr!D.H.Davis
Bath, BA2 7AY     EARN/BITNET: D.H.Davis%uk.ac.bath at UKACRL
England              INTERNET: D.H.Davis%bath.ac.uk at nsfnet-relay.ac.uk



More information about the Comp.unix.questions mailing list