We can use nl (number line) command in such situation. If the file is big, to make the file the readable through scrolling, pipe can be used.
This would be the output.
The default behavior of
nlis to skip blank lines, as shown above. The treatment of blank lines can be modified with the
-ba(number all lines),
-bt(number only text lines -- the default behavior)