Article View: comp.editors
Article #3825Re: Adding Line Numbers to a text file
From: Fred Smith
Date: Mon, 21 Sep 1998 00:00
Date: Mon, 21 Sep 1998 00:00
24 lines
1957 bytes
1957 bytes
Dominic Mitchell (dom@phmit.demon.co.uk) wrote:
: 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:
Or if you have a grep utility:
grep -n '^.*$' infile > outfile
Fred
--
---- Fred Smith -- fredex@fcshome.stoneham.ma.us -----------------------------
"For the word of God is living and active. Sharper than any double-edged
sword, it penetrates even to dividing soul and spirit, joints and marrow;
it judges the thoughts and attitudes of the heart."
---------------------------- Hebrews 4:12 (niv) ------------------------------
Technical Details
Message-ID:
<EznnFE.Axt@fcshome.stoneham.ma.us>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<XZpN1.21$K%5.67531@nsw.nnrp.telstra.net> <6u5mb4$cb4$1@voodoo.pandhm.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 108eba,b1a82c63440172f5 X-Google-Attributes: gid108eba,public X-Google-Thread: 1018fa,b1a82c63440172f5 X-Google-Attributes: gid1018fa,public X-Google-Thread: 10bba1,b1a82c63440172f5 X-Google-Attributes: gid10bba1,public X-Google-Thread: 107393,b1a82c63440172f5 X-Google-Attributes: gid107393,public From: fredex@fcshome.stoneham.ma.us (Fred Smith) Subject: Re: Adding Line Numbers to a text file Date: 1998/09/21 Message-ID: <EznnFE.Axt@fcshome.stoneham.ma.us> X-Deja-AN: 393564175 References: <XZpN1.21$K%5.67531@nsw.nnrp.telstra.net> <6u5mb4$cb4$1@voodoo.pandhm.co.uk> Organization: None! Followup-To: comp.editors,comp.text,fj.editor.misc,okinawa.comp.editors Newsgroups: comp.editors,comp.text,fj.editor.misc,okinawa.comp.editors