Показывать номер строки при поиске одного файла

471
Sanghyun Lee

ack обычно показывает номера строк с именем файла,

$ ack searchme filename 1:searchme 

но это не так, когда поиск по одному файлу,

$ ack searchme filename searchme 

Показывать номера строк легко grep

$ grep -n searchme filename 1:searchme 

Могу ли я показать номера строк при поиске одного файла с помощью ack?

1

1 ответ на вопрос

2
DavidPostill

This issue was raised as a bug for ack Output line numbers of matches when acking a single file #244 with the following response:

All future development on ack is happening on https://github.com/petdance/ack2. This issue has been moved here: Do we need an option for forcing the printing of the line number? #196

The status of the ack2 request is open.

Output line numbers of matches when acking a single file #244 does include a patch which may resolve the issue as well as the following comment:

Nevertheless using --with-filename option will always print file name and therefore line numbers.

Похожие вопросы