本文共 1031 字,大约阅读时间需要 3 分钟。
You can under Linux or Unix like operating systems. The cat command also number all output lines starting with number one with the following syntax:
cat -n fileNameHere
OR
cat --number foo.c
The -b / --number-nonblank option number all nonempty output lines, starting with one and the syntax is:
cat -b fileNameHere
OR
cat --number--nonblank filename
Finally, you suppress or remove repeated empty output lines with the -s / --squeeze-blank option:
cat -s -n fileNameHere
OR
cat --squeeze-blank -n filename
Use under Linux or Unix oses. The syntax is:
Create a text file called hello.c as follows:
Use the cat or nl command to display line numbers:
Sample outputs:
Fig.01: Displaying line numbers for hello.c using the cat and nl command.
转载地址:http://yxiqb.baihongyu.com/