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

Request: --no-group-separator option #363

Open
hftf opened this issue Oct 11, 2022 · 4 comments
Open

Request: --no-group-separator option #363

hftf opened this issue Oct 11, 2022 · 4 comments
Labels

Comments

@hftf
Copy link

hftf commented Oct 11, 2022

Ack, grep, and other programs sensibly print -- between groups of context (-A/-B/-C). However, it would be nice to disable the -- with an option especially when the output will be further processed. GNU grep has a --no-group-separator option for this.

See also https://stackoverflow.com/questions/2168065/how-do-i-get-rid-of-line-separator-when-using-grep-with-context-lines.

@petdance
Copy link
Collaborator

Seems useful. First thing that comes to mind is that we may have confusing with --group/--nogroup. I'm not saying that's a show-stopper.

Please tell me about how you would use this.

@hftf
Copy link
Author

hftf commented Oct 11, 2022

For an example, I have a log of stenography keystrokes pressed (one stroke per line) and use the -A/-B/-C context feature to get all strokes before or after an undo stroke, so I can see which words I commonly mistype and what are the misstrokes I write instead. Further processing of the output is done to extract the words from within the log's line format, sort, tally, etc. I don't need the group separators during further processing, although it doesn't get in the way too badly.

@glanois
Copy link

glanois commented Nov 24, 2023

@petdance says

Please tell me about how you would use this.

space-track.org publishes satellite orbital elements (3 lines per satellite - first line is the name, and the 2nd and 3rd lines are the data). I use ack with -A 2 as a filter to select satellites by name.

I really don't want the -- in the output - it breaks my downstream applications.

Here is the documentation of the format:
https://www.space-track.org/documentation#tle-basic

Would appreciate it if you were to add this --no-group-separator option.

As a workaround I'm just using Gnu grep for this step.

@petdance
Copy link
Collaborator

As a workaround I'm just using Gnu grep for this step.

That doesn't sound like a workaround. It sounds like using the right tool for the job.

If the use case is a pipeline, and grep works, I'd suggest using grep. ack is geared towards being read by humans on a screen.

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

No branches or pull requests

3 participants