The 'nl' command adds line numbers to files or to terminal output.
+ Number non-blank lines in a file:
nl path/to/file
+ Number non-blank lines in ouptut from stdin:
command | nl
ex: seq 10 | nl
+ Number [a]ll [b]ody lines including blank lines or do [n]ot number body lines:
nl -b a path/to/file
+ Do [n]ot number [b]ody lines (essentially this suppresses the line numbers):
nl -b n path/to/file
NOTE The above command is not that different than 'cat' or 'less' except that 'nl -b n' does reserve space for where the line numbers would have been.
+ Number only the lines matching a basic regex [p]attern:
nl -b p'FooBar[0-9]' path/to/file
-OR-
nl -b p'^#' .bashrc
+ Use a specific [i]ncrement for line numbering:
nl -i NUMBER path/to/file
+ Specify the line numbering width (default = 6):
nl -w NUMBER path/to/file
+ Specify [n]umber-format as [r]ight justified with leading [z]eroes:
nl -n rz path/to/file
+ Specify [n]umber-format as [r]ight justified with [n]o leading zeroes:
nl -n rn path/to/file
+ Specify [n]umber-format as [l]eft justified with [n]o leading zeroes:
nl -n ln path/to/file
+ Use a specific string to separate line numbers from the lines (default = TAB):
nl -s ' | ' path/to/file
REFERENCED:
โบ https://gitlab.com/dwt1/vidman
WANT TO SUPPORT THE CHANNEL?
๐ฐ Patreon: https://www.patreon.com/distrotube
๐ณ Paypal: https://www.paypal.com/donate/?hosted_button_id=MW3ZFGS8Q9JGW
๐๏ธ Amazon: https://amzn.to/2RotFFi
๐ Teespring: https://teespring.com/stores/distrotube
DT ON THE WEB:
๐ธ๏ธ Website: http://distro.tube
๐ GitLab: https://gitlab.com/dwt1
๐จ๏ธ Mastodon: https://fosstodon.org/@distrotube
๐ซ Reddit: https://www.reddit.com/r/DistroTube/
๐ฝ๏ธ Odysee: https://odysee.com/@DistroTube:2
FREE AND OPEN SOURCE SOFTWARE THAT I LIKE:
๐ Brave Browser - https://brave.com/
๐ฝ๏ธ Open Broadcaster Software: https://obsproject.com/
๐ฌ Kdenlive: https://kdenlive.org
๐จ GIMP: https://www.gimp.org/
๐ป VirtualBox: https://www.virtualbox.org/
๐๏ธ Doom Emacs: https://github.com/hlissner/doom-emacs
Your support is very much appreciated. Thanks, guys!
...
https://www.youtube.com/watch?v=2SyiQrsPyu8