nl

作者: Kokoronashi | 来源:发表于2019-01-03 18:45 被阅读0次

nl 命令

命令简介

nl(Number of Lines)将指定的文件添加行号标注后写到标准输出。如果不指定文件或指定文件为"-" ,程序将从标准输入读取数据。

-b : 指定添加行号的方式,主要有两种:
-b a:表示无论是否为空行,同样列出行号("cat -n"就是这种方式)
-b t:只列出非空行的编号并列出(默认为这种方式)
-n : 设置行号的样式,主要有三种:
-n ln:在行号字段最左端显示
-n rn:在行号字段最右边显示,且不加0
-n rz:在行号字段最右边显示,且加0
-w : 行号字段占用的位数(默认为6位)


image.png
Usage: nl [OPTION]... [FILE]...
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.
  -b, --body-numbering=STYLE      use STYLE for numbering body lines 使用指定样式编号文件的正文行目
  -d, --section-delimiter=CC      use CC for separating logical pages 使用指定的CC 分割逻辑页数
  -f, --footer-numbering=STYLE    use STYLE for numbering footer lines 使用指定样式编号文件的页脚行目
  -h, --header-numbering=STYLE    use STYLE for numbering header lines 使用指定样式编号文件的页眉行目
  -i, --line-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, --starting-line-number=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
  pBRE      number only lines that contain a match for the basic regular
            expression, BRE

FORMAT is one of:

  ln   left justified, no leading zeros
  rn   right justified, no leading zeros
  rz   right justified, leading zeros


GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'nl invocation'

相关文章

  • NL

    等二批也也许我们有点逼自己的感觉也许我们有点逼自己的感觉,那转化到行动可变策略里面就是我来改变我的改变引发外在的改...

  • Nl

    各位朋友,大家好,各位秋文的伙伴,大家好,OK,心理学实操线上课程,然后这是一套我们秋文心理学院推出的然后,也算是...

  • nl

    nl 命令 命令简介 nl(Number of Lines)将指定的文件添加行号标注后写到标准输出。如果不指定文件...

  • Linux中的管道命令(二)

    nl nl为文件添加行号,data文件的内容为: 使用nl输出data文件: 可以看到,nl为data文件添加了行...

  • everyday:linux nl

    everyday:linux nl [TOC] 功能说明 nl,用来计算文件中行号。nl 可以将输出的文件内容自动...

  • Wifi笔记 | wpa_supplicant与内核的通信

    内核中nl80211模块 nl80211直接使用的是Generic Netlink接口,添加了一个name为“nl...

  • Shell文本操作命令

    查看文本行数:wc -l filename nl (Number of Lines)nl [选项] filenam...

  • Linux命令学习之:nl命令

    Linux命令学习之:nl命令 nl命令在linux中用来计算文件中的行号。nl可以将输出的文件内容自动加上行号,...

  • 20. 格式化输出

    [TOC] 简单的格式化工具 nl 添加行号 nl 命令用于简单的任务。它添加文件的行数: nl 既能接受多个文件...

  • WSL2错误Error 0x1bc解决

    解决方案:https://docs.microsoft.com/nl-nl/windows/wsl/wsl2-ke...

网友评论

      本文标题:nl

      本文链接:https://www.haomeiwen.com/subject/wneqrqtx.html