🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.editors
Article #3824

Re: Adding Line Numbers to a text file

#3824
From: Dominic Mitchell
Date: Mon, 21 Sep 1998 00:00
18 lines
1837 bytes
In comp.text, Arnzie <mkarnel@ballarat.starway.net.au> wrote:
>Hi, I was wondering if anybody could tell me where I could find a program
>which prints line numbers.
>I have a text file with the code from a program I made in Borland JBuilder,
>and I want to add line numbers to the start
>for easy reference. If anybody knows of such a program, could they please
>email me at mkarnel@ballarat.starway.net.au

If your Unix has it, you can use the nl(1) utility.  Otherwise, some
versions of cat(1) can do line numbering for you.  Failing all that, try
using a little awk(1) script along the lines of:

$ awk '{print NR, $0}' file > newfile
-- 
Dom Mitchell -- Palmer & Harvey McLane -- Unix Systems Administrator
"Xerox studies suggest that most people print out electronic mail
 that is longer than half a page; paper use rises by 40 percent in
 offices that introduce E-mail." -- CCM
Technical Details
Message-ID: <6u5mb4$cb4$1@voodoo.pandhm.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <XZpN1.21$K%5.67531@nsw.nnrp.telstra.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107393,b1a82c63440172f5
X-Google-Attributes: gid107393,public
X-Google-Thread: 10bba1,b1a82c63440172f5
X-Google-Attributes: gid10bba1,public
X-Google-Thread: 108eba,b1a82c63440172f5
X-Google-Attributes: gid108eba,public
X-Google-Thread: 1018fa,b1a82c63440172f5
X-Google-Attributes: gid1018fa,public
From: Dominic Mitchell <dom@phmit.demon.co.uk>
Subject: Re: Adding Line Numbers to a text file
Date: 1998/09/21
Message-ID: <6u5mb4$cb4$1@voodoo.pandhm.co.uk>
X-Deja-AN: 393295303
X-NNTP-Posting-Host: phmit.demon.co.uk:194.222.15.209
Sender: dom@voodoo.pandhm.co.uk
References: <XZpN1.21$K%5.67531@nsw.nnrp.telstra.net>
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 906388054 nnrp-03:3607 NO-IDENT phmit.demon.co.uk:194.222.15.209
Organization: Palmer & Harvey McLane Ltd.
Newsgroups: comp.editors,comp.text,fj.editor.misc,okinawa.comp.editors