Coder Social home page Coder Social logo

Comments (9)

tnelson-doghouse avatar tnelson-doghouse commented on June 11, 2024 1

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,

from ack3.

petdance avatar petdance commented on June 11, 2024

So what would ack --field 2 tnelson do? Do a regex match against the 2nd field for /tnelson/ ?

from ack3.

tnelson-doghouse avatar tnelson-doghouse commented on June 11, 2024

Exactly! Just like the Perl code does.

from ack3.

petdance avatar petdance commented on June 11, 2024

What's your use case? What are you doing such that this feature would be useful?

from ack3.

n1vux avatar n1vux commented on June 11, 2024

Use Case -- This is searching tab-, space-, comma-, or whatever-delimited data files, subsuming the function of csv-grep (which if we don't list on the alternatives BeyondGrep page we should!)

If we hold hard to the "ack is for searching code, off-label usage tolerated but not supported" mantra, this is an easy "nope, use Text::CSV or awk or csv-grep for that use case".

( OTOH i'm generally in favor of taking a first step, any first step, on the slippery slope towards supporting linguistic use.
--field 2 is roughly the inverse of my coveted --paragraph or -000 mode -- generalizing selection of unit to display and unit to search.)

from ack3.

petdance avatar petdance commented on June 11, 2024

I can certainly imagine use cases, but I'm asking what @tnelson-doghouse 's use case is that brought it up.

from ack3.

petdance avatar petdance commented on June 11, 2024

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

ack --field 2 tnelson

would be the same as

awk '$2 =~ /tnelson/'

and would have identical output, yes?

from ack3.

tnelson-doghouse avatar tnelson-doghouse commented on June 11, 2024

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.

from ack3.

petdance avatar petdance commented on June 11, 2024

I'm not really interested in doing this, but I'm not saying no yet.

from ack3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.