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.