Find line number

How to find a line number?

I have a file:

1
5
8
9
10
15

Is there a simple method to find out on which line for example the 9 is written?

sed -n '/^9$/=' file
$ awk '/9/{print NR}' infile
1 Like

Thanks, this is handy for text too.