How to get line numbers in file through cat command
Cat command can be used for many purposes. But do you also know you can see the line numbers in files with the help of cat command. With this method it is easy to troubleshoot or this information is also useful while creating the bash script.
Use the given below command
With cat command use -n flag
cat -n filename
Below is the screenshot of example.
Nathan Phillip Brink (binki) says
You’re using non-POSIX options for cat. See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html for the options which cat should implement to be called “cat”. Seems that -u is the only required one.
I have taken option from man page of cat.