How to display line number while doing grep on a file. For example:
grep CONFIG_PM_ADVANCED_DEBUG /boot/config-`uname -r
There is the option -n, and many more in the manual page, worth reading.
grep -n <pattern> <file> prefixes each line of output with the line number in the input file. Is this what you are looking for?
grep -n <pattern> <file>
alias grep='grep -inE --color=auto'
This will color the match as well for easy reading.
Have you checked cat -n 'filename'. This will print the line numbers.
cat -n 'filename'
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
3 years ago
2 years ago