nl (Number of Lines) 將指定的文件添加行號標註後寫到標準輸出。若是不指定文件或指定文件爲"-" ,程序將從標準輸入讀取數據。正則表達式
nl [選項]... [文件]...
-b, --body-numbering=樣式 使用指定樣式編號文件的正文行目 -d, --section-delimiter=CC 使用指定的CC 分割邏輯頁數 -f, --footer-numbering=樣式 使用指定樣式編號文件的頁腳行目 -h, --header-numbering=樣式 使用指定樣式編號文件的頁眉行目 -i, --page-increment=數值 設置每一行遍歷後的自動遞增值 -l, --join-blank-lines=數值 設置數值爲多少的若干空行被視做一行-n, --number-format= 格式 根據指定格式插入行號
[root@oracledb study]# nl test1.log 1 2011 2 2012 3 2013
[root@oracledb study]# nl -nln test1.log 1 2011 2 2012 3 2013 [root@oracledb study]# nl -nrn test1.log 1 2011 2 2012 3 2013 [root@oracledb study]# nl -nrz test1.log 000001 2011 000002 2012 000003 2013
[root@oracledb study]# nl -nrz -w 4 test1.log 0001 2011 0002 2012 0003 2013
[root@oracledb study]# nl line1 1 line1 line2 2 line2 line3 3 line3 [root@oracledb study]#
[root@oracledb study]# nl <<EOF > line1 > line2 > line3 > EOF 1 line1 2 line2 3 line3