Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the nl command of linux-add line number

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the nl command about using linux-adding line numbers, the editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

The nl command is an easy to use number filtering tool. This command reads the File parameter (standard input by default), calculates the line number in the input, and writes the calculated line number to standard output.

Syntax format: nl [parameters] [file]

Common parameters:

-b specifies how the line number is specified-n lists how the line number is represented-the number of bits occupied by the w line number field-p does not restart the calculation at the logical delimiter.

Reference example

Use nl to list the contents of log2.log:

[root@linuxcool ~] # nl log2.log

List the contents of the log2.log in nl, and add the line number to the blank line:

[root@linuxcool] # nl-b a log2.log

Let the line number be automatically preceded by 0 to unify the output format:

[root@linuxcool] # nl-b a-n rz log2.log

Blank lines do not display line numbers:

[root@linuxcool] # nl-b t log2.log

The added line number is on the right:

[root@linuxcool~] # nl-n rn log2.log about using linux nl command-add line number to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report