I\'m writing the script that searches for lines that match some pattern. I must use sed for this script. This works fine for searching and printing matched lines:
= is used to print the line number.
=
sed -n /PATTERN/{=;p;}