Skip to content
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

--break must be set to 0 if we're piping #84

Closed
petdance opened this issue Sep 14, 2009 · 1 comment
Closed

--break must be set to 0 if we're piping #84

petdance opened this issue Sep 14, 2009 · 1 comment

Comments

@petdance
Copy link
Collaborator

Reported by petdance, Apr 07, 2008

When piping output to a filter, we have to set --break=0 because otherwise
the spaces can affect things.

Specifically, I did this:

$ ack foo

and saw all the results and wondered how many there were, so I did

$ ack foo | wc -l

which gave me 109, which seemed high, so I did

$ ack foo --nogroup | wc -l

and got 72. Bad bad bad.

Delete comment
Comment 1 by torsten.blix, May 05, 2008

Is this fixed already?

I can't reproduce it. Doing

$ ack foo | wc -l

in the ack svn checkout, I get 53 hits. The same amount as I get with --nogroup.

And looking in the code, the break option defaults to $to_screen which should be 0
when piping ...

Delete comment
Comment 2 by petdance, May 06, 2008

It's coming from my .ackrc. It looks like this.

Always sort

--sort-files

I'm tired of grouping

--noheading
--break

Delete comment
Comment 3 by torsten.blix, May 09, 2008

Ahh, I see, ok.

The problem with this is that then there is no way to specify that you DO want to
have breaks in your output when it is going to a file/piped. This breaks for example
a couple of our tests.

Or are you suggesting that just the --break option specified in the .ackrc file - and
NOT the --break option given on the command line - is to be ignored when piping? This
would leave the tests alone but would require some more thoughts on the
implementation and would introduce more complexity for the user in understanding the
subtle differences between command line and .ackrc.

@hoelzro
Copy link
Collaborator

hoelzro commented Aug 28, 2013

As far as I can tell, this is fixed in ack2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants