Linux/Unix: Cat Command Display Line Numbers
You can display line numbers with the cat command by using the nl (number lines) command. Here's an example:
nlWhere is the name of the file you want to display with line numbers. The nl command will print the contents of the file, with each line numbered.
If you want to display line numbers only for non-empty lines, you can use the following syntax:
nl -b aThis will print the line numbers only for lines that contain characters, ignoring empty lines.
