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