home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: nice Chapter 2
UNIX Commands
Next: Reference: nm





] [



Number the lines of file in logical page segments. Numbering resets to 1 at the start of each page.


-b type

Number lines according to type . Values are:

a All lines.
n No lines.

Text lines only (the default).

p " exp "

Lines containing exp only.

-d xy

Use characters xy to delimit logical pages (default is \:).

-f type

Like -b but number footer (default type is n ).

-h type

Like -b but number header (default type is n ).

-i n

Increment each line number by n (default is 1).

-l n

Count n consecutive blank lines as one line.

-n format

Set line number format . Values are:


Left justify, omit leading zeros.


Right justify, omit leading zeros (default).


Right justify.


Do not reset numbering at start of pages.

-s c

Separate text from line number with character(s) c (default is a tab).

-v n

Number each page starting at n (default is 1).

-w n

Use n columns to show line number (default is 6).


List the current directory, numbering files as 1), 2), etc.:

ls | nl -w3 -s')  '

Number C source code and save it:

nl prog.c > print_prog

Number only lines that begin with #include:

nl -bp"^#include" prog.c

Previous: Reference: nice UNIX in a Nutshell: System V Edition Next: Reference: nm
Reference: nice Book Index Reference: nm

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System