[olug] Unix Tip: LINE NUMBERS IN LINUX

Daniel G. Linder dlinder at iprevolution.com
Tue Apr 15 20:02:51 UTC 2003


Ok, here is my "OBLinuxHack"(1) versions of this:

Unix Guru Universe [mailto:listserv at ugu.com] wrote:
> If you want a file with line 
> numbers (say for printing).
> You can use the "nl" command 
> in linux.
> 
> $ nl file.c > file.c.num

With the GNU cat program, you can do this:
  cat -n some.file and it precedes each line with the line number.

  Handy for e-mailing a quick reference to a co-worker and having saying
"see line 102" rather than saying "see the line that starts with ...."

Dan

Note 1: Props to the first person that can recognize where the
"OB___Hack" came from (at least where I knew it from)... :)


More information about the OLUG mailing list