grep -n <pattern> <file>
Computer Tips - grep: How can I get grep to show line numbers of its hits?
Date: 2016apr16
OS: Linux
Product: grep
Level: novice
Q. grep: How can I get grep to show line numbers of its hits?
A. Use the -n option like this: