所有非空行的行号?

Eva*_*oll 1 text-processing cat nl

在这里有点好笑,我正在尝试通过先决条件,以进入佐治亚理工学院Udacity 高性能计算机体系结构课程对于我的生活,我无法弄清楚他们想要什么,

问题朗读,

要列出文件的内容,并显示非空行的行号,请使用带有选项的命令:________ ___ 文件名。

我试过了nl。它没有用。有史以来最奇怪的问题。

题

mur*_*uru 6

虽然cat的编号不是 POSIX,nl是,并且 POSIX 还定义了nl使用的编号样式:

?b type  Specify which logical page  body  lines  shall  be  numbered.
         Recognized types and their meaning are:

         a       Number all lines.

         t       Number only non-empty lines.

         n       No line numbering.

         pstring Number  only  lines  that  contain  the basic regular
                 expression specified in string.

         The default type for logical page body shall be t (text lines
         numbered).
Run Code Online (Sandbox Code Playgroud)

所以,即使它是默认的:

nl -bt filename
Run Code Online (Sandbox Code Playgroud)