nl command
syntax
nl [options] [file]
為檔案的內容編定列號後輸出其結果.此命令除可為本文(body)
編定列號外,亦可以透過選項的設定,對一班不編定列號的
標頭 (header) 與 標尾(footer) 進行編號.
列號的編訂乃是以邏輯頁面(logical page)為單位;一個邏輯頁面
是由標頭,本文,與標尾三個部份組成.於所想處理的檔案中,這三個
部份依序是由特殊的字串
\:\:\:
\:\:
\:
這三個來予以界定.
常用選項
-b, --body-numbering=STYLE
use STYLE for numbering body lines
-d, --section-delimiter=CC
use CC for separating logical pages
-f, --footer-numbering=STYLE
use STYLE for numbering footer lines
-h, --header-numbering=STYLE
use STYLE for numbering header lines
-i, --page-increment=NUMBER
line number increment at each line
-l, --join-blank-lines=NUMBER
group of NUMBER empty lines counted as one
-n, --number-format=FORMAT
insert line numbers according to FORMAT
-p, --no-renumber
do not reset line numbers at logical pages
-s, --number-separator=STRING
add STRING after (possible) line number
-v, --first-page=NUMBER
first line number on each logical page
-w, --number-width=NUMBER
use NUMBER columns for line numbers
--help display this help and exit
--version
output version information and exit
By default, selects -v1 -i1 -l1 -sTAB -w6 -nrn -hn -bt -fn. CC
are two
delimiter characters for
separating logical pages, a missing second
character implies :. Type \\
for \. STYLE is one of:
a
number all lines
t
number only nonempty lines
n
number no lines
pREGEXP
number only lines that contain a match for REGEXP
FORMAT is one of:
ln left
justified, no leading zeros
rn right
justified, no leading zeros
rz right
justified, leading zeros
AUTHOR
Written by Scott Bartram and David
MacKenzie.
REPORTING BUGS
Report bugs to
<bug-coreutils@gnu.org>.