-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add field support (a la Perl) #366
Comments
So what would |
Exactly! Just like the Perl code does. |
What's your use case? What are you doing such that this feature would be useful? |
Use Case -- This is searching tab-, space-, comma-, or whatever-delimited data files, subsuming the function of If we hold hard to the " ( OTOH i'm generally in favor of taking a first step, any first step, on the slippery slope towards supporting linguistic use. |
I can certainly imagine use cases, but I'm asking what @tnelson-doghouse 's use case is that brought it up. |
The thing that led to this ticket was the fact that I've been writing that Perl about once a week/fortnight for years. In the most recent case, I had a program that would output a list of client e-mails and the websites they were allowed to access. I wanted to search for all e-mail addresses for a particular client, but because the string was also in the website, it was also listing eg. all our internal users with access to that website as well. I wanted to search on just the e-mail field. Fairly specific use case, but I write that same thing so often I thought it might be a useful feature for others. HTH, |
So it sounds like you're not using the acky things that make ack ack, like all the pretty color coding. If I'm understanding right, your suggested
would be the same as
and would have identical output, yes? |
I think so, yes. I learned Perl early in my Unix journey, and never ended up doing much awk. Except maybe with better colouring and the like. This would be more relevant with things like: grep -C 3 regex filename Then you'd still get the highlighting, which could be handy. |
I'm not really interested in doing this, but I'm not saying no yet. |
ls -laF | perl -ane 'if($F[2] =~ /tnelson/){print}'
If there was a
--field 2
option, then I could do this as:ls -laF | ack --field 2 tnelson
You might also want to pair this with -F / --separator (as per perl's -F)
HTH,
The text was updated successfully, but these errors were encountered: