Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Emacs line number code?

2 views
Skip to first unread message

sc...@lighthouse.softbase.com

unread,
May 1, 1997, 3:00:00 AM5/1/97
to

Anyone know of code that will insert line numbers into a file
at the beginning of a line, and do things like skip blank
lines?

Scott


ssj...@uta.fi

unread,
May 2, 1997, 3:00:00 AM5/2/97
to

See command from my lisp libraries. (there is also ti::b-remove-line-numbers,
my-print-with-line-numbers )

jari

Pick URL ftp://cs.uta.fi/pub/ssjaaa/ or /f...@cs.uta.fi:/pub/ssjaaa/
(The "access denied" just means the site is busy; try a little later)
The main html page is named after my login name: ssjaaa.html


(defun ti::b-insert-line-numbers (beg end &optional line grow format)
"Inserts line numbers to buffer.
Mark the region where to insert the line numbers. C-x h to mark
whole buffer for insertion.

The default line format is '%02d:%s' for values lower that 100.
For bigger values the format is dynamical (digit len derived from
start value)

Input:
beg,end ,point ,area bounds
line ,nbr ,starting line number is 1 by default
grow ,nbr ,grow by 1 is default
format ,str ,how line is formatted, see above
...

Vardhan Varma

unread,
May 2, 1997, 3:00:00 AM5/2/97
to

>>>>> "Scott" == <sc...@lighthouse.softbase.com> writes:

Scott> Anyone know of code that will insert line numbers into a file
Scott> at the beginning of a line, and do things like skip blank
Scott> lines?

'cat' has some option to print with line number. i'm on NT and
don't have a cat handy.

for removing blank lines, try grep -v '^[ \t]*$'

--
#===# Vardhan Varma <Var...@Bitsmart.com>| An addicted NetHacker |
|PAR| Parsec Technologies (India) | An addicted Programmer |
|SEC| Fax and Voice processing systems +------------------------+
#===# Still looking for a quote witty enough to grace this place.. |


David Combs

unread,
May 3, 1997, 3:00:00 AM5/3/97
to

In article <199705021248.MAA06073@linux>,

Vardhan Varma <Var...@bitsmart.com> wrote:
>
>>>>>> "Scott" == <sc...@lighthouse.softbase.com> writes:
>
>Scott> Anyone know of code that will insert line numbers into a file
>Scott> at the beginning of a line, and do things like skip blank
>Scott> lines?
>
> 'cat' has some option to print with line number. i'm on NT and
> don't have a cat handy.
>
> for removing blank lines, try grep -v '^[ \t]*$'

For god's sake, get MKS-tools, and then supplement
that with gnu grep, etc.

MKS-tools gives you k-shell, all the usual unix tools (eg cat),
etc. About $300?


Emilio Lopes

unread,
May 6, 1997, 3:00:00 AM5/6/97
to

David Combs (dkc...@netcom.com) wrote:
: For god's sake, get MKS-tools, and then supplement

: that with gnu grep, etc.
:
: MKS-tools gives you k-shell, all the usual unix tools (eg cat),
: etc. About $300?

For free you can get the GNU tools (a lot better than the "usual"
unix tools) from Cygnus for msdog and friends.

--
Emilio C. Lopes <mailto:Emilio...@Physik.TU-Muenchen.DE>

0 new messages