--- layout: page topic: The nl command author: Domenico Votta category_title: Advanced Commands category_page: Advanced tags: number lines title: nl ---
The nl
is a command that permits to number the lines. Through some flags you can decide how to filter this command.
example.txt
that contains 5 elements, to test this command:
{% highlight ruby linenos %}
Car
Computer
Robot
Smartphone
Videogame
{% endhighlight %}
The syntax command is:
nl [flags][file]{% highlight ruby linenos %} nl example.txt 1 Car 2 Computer 3 Robot 4 Smartphone 5 Videogame {% endhighlight %}
How you can see the command has numbered the lines.
Here a list that contains the main flags of these command:
p^[cv]
says to nl to number only the lines that start with c and v.