Linux "nl" Command Line Options and Examples
number lines of files

Write each FILE to standard output, with line numbers added. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too.


Usage:

nl [OPTION]... [FILE]...




Command Line Options:

-b
use STYLE for numbering body lines
nl -b ...
-d
use CC for logical page delimiters
nl -d ...
-f
use STYLE for numbering footer lines
nl -f ...
-h
use STYLE for numbering header lines
nl -h ...
-i
line number increment at each line
nl -i ...
-l
group of NUMBER empty lines counted as one
nl -l ...
-n
insert line numbers according to FORMAT
nl -n ...
-p
do not reset line numbers for each section
nl -p ...
-s
add STRING after (possible) line number
nl -s ...
-v
first line number for each section
nl -v ...
-w
use NUMBER columns for line numbers
nl -w ...
--help
display this help and exit
nl --help ...
--version
output version information and exitBy default, selects -v1 -i1 -l1 -sTAB -w6 -nrn -hn -bt -fn. CC are two delimiter characters used to constructlogical page delimiters, a missing second character implies :. Type \\ for \. STYLE is one of:a number all linest number only nonempty linesn number no linespBRE number only lines that contain a match for the basic regular expression, BREFORMAT is one of:ln left justified, no leading zerosrn right justified, no leading zerosrz right justified, leading zerosAUTHORWritten by Scott Bartram and David MacKenzie.REPORTING BUGSGNU coreutils online help: <http://www.gnu.org/software/coreutils/>Report nl translation bugs to <http://translationproject.org/team/>COPYRIGHTCopyright © 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later<http://gnu.org/licenses/gpl.html>.This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent per‐mitted by law.
nl --version ...