-
Notifications
You must be signed in to change notification settings - Fork 95
Output line numbers of matches when acking a single file #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your "bug" is actually "intentional behavior that you don't like." We can talk about the pros and cons of that design choice, but it's not a bug. It matches the behavior of grep. With ack 2.00b02
With grep:
|
Probably my description was not clear enough... In the following example I expect
I can do it easily with
|
After looking at source code I found the reason of this behavior. The problem is that printing line numbers depends on printing file name which is off for single file.
Nevertheless using |
Hi, the default choice is not really a problem. Grep has a flag to force line numbers on, which is what I'm looking for. |
All future development on ack is happening on https://github.com/petdance/ack2. This issue has been moved here: beyondgrep/ack2#196 |
Ack automatically outputs line numbers when searching inside directories or in multiple files, but not when searching in a single file.
Here is related discussion on this bug: https://groups.google.com/forum/?fromgroups=#!topic/ack-users/DYLSP3bemLw
Workaround is to search in some second file as well, for example in /dev/null:
The text was updated successfully, but these errors were encountered: