如何使用shell命令打印与模式匹配的相应行的行号?

Nai*_*ita 10 shell awk shell-script text-processing

文件,

.false alarm is bla no. 11
.no alarm generated is bla
.application will be killed is bla wall command
.doc file is document file with .doc extension
.no authority for this selection bla
Run Code Online (Sandbox Code Playgroud)

现在我想在我的输出文件中打印只包含单词的行bla(或者它也可能是数字)

输出将是这样的,

1 .false alarm is bla no. 11
2 .no alarm generated is bla
3 .application will be killed is bla wall command
5 .no authority for this selection bla
Run Code Online (Sandbox Code Playgroud)

jim*_*mij 19

许多工具可以派上用场: