- Linux Training
- Desktop Tutorials
- Server Tutorials
|Linux Commands - Managing Files and Text|
The nl command is used to number lines in a text file. The command allows you to add options to create the style of numbering required. Here is an example:
nl -b t data
In this example the style to number only lines that have text has been chosen.
-b set numbering to style chosen, t is the default
-f set the footer number style n being the default
-h set the header numbering n being the default
A set a number for every line even if empty
t number only lines with text
n do not number lines
p textstring search for a specific text string in the file
Here is an example of searching for a text string which is searching for the text string vim.
nl -b pvim data