I have found that the a regex beginning with a caret that finds matches in a file doesn't list the files found when the -l / --files-with-matches option is used unless the match occurs in the first line.
Steps to reproduce:
Create testfile: echo -n "Don't Match this line\n but this one" > ack_testfile
Find matches with ack: ack --noenv '^\s+' ack_testfile
If I search for "^Don't" the -l option works as expected.
It seems like the meaning of ^ changes from 'beginning of line' to 'beginning of file' when the the -l option is used.
This should either be mentioned in the man page (or maybe a warning should be displayed when using that option) or preferably ack should behave the same with and without those options (-L / --files-without-matches is also affected).
I have found that the a regex beginning with a caret that finds matches in a file doesn't list the files found when the
-l
/--files-with-matches
option is used unless the match occurs in the first line.Steps to reproduce:
echo -n "Don't Match this line\n but this one" > ack_testfile
ack --noenv '^\s+' ack_testfile
but this one
ack --noenv -l '^\s+' ack_testfile
ack_testfile
If I search for "^Don't" the
-l
option works as expected.It seems like the meaning of
^
changes from 'beginning of line' to 'beginning of file' when the the-l
option is used.This should either be mentioned in the man page (or maybe a warning should be displayed when using that option) or preferably ack should behave the same with and without those options (
-L
/--files-without-matches
is also affected).