GNU/Linux Command – NL

nl – Number lines of files
Write each FILE to stdout, with line numbers added. With No FILE or -, read from stdin.
$ nl myfile -- Writes all non-empty lines with number.  $ nl -ba myfile -- Number all lines.  $ nl -ba -l2 myfile -- Count 2 empty line as 1 and display  $ nl -nln myfile -- Numbers are left justified.  $ nl -nrz myfile -- Numbers are right justified and leading zeros  $ nl -w2 myfile -- Uses 2 column for the line number.  $ nl -s"> " myfile -- Insert "> " in between number and line.  $ nl -bp"^T" myfile -- Number the lines start with char 'T'.  $ ls | nl -- ls Output with line numbers
Read: man nl

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: