Comments (9)
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.
So what would ack --field 2 tnelson
do? Do a regex match against the 2nd field for /tnelson/
?
from ack3.
Exactly! Just like the Perl code does.
from ack3.
What's your use case? What are you doing such that this feature would be useful?
from ack3.
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.
I can certainly imagine use cases, but I'm asking what @tnelson-doghouse 's use case is that brought it up.
from ack3.
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.
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.
I'm not really interested in doing this, but I'm not saying no yet.
from ack3.
Related Issues (20)
- Unicode troubles? HOT 10
- $ not escaped by \Q? HOT 5
- Add .adoc to filetypes HOT 5
- Browsing at root of system resources not allowed HOT 3
- beyondgrep.com SSL certificate expired HOT 2
- Missing extension for R language HOT 3
- Add an option to show first N lines (--head=N) HOT 21
- Add option for color search HOT 2
- Get a new test codebase for timings
- Support ".ps1" PowerShell file type HOT 6
- Request: --no-group-separator option HOT 4
- ack manual ACK COLORS: typing errors `ACK COLOR_LINENO` + `ACK COLOR_COLNO` HOT 5
- Add GN (Generate Ninja) filetype HOT 3
- -x and --type=format options should be mutex HOT 4
- Add a -X that acts like -x but obeys the --type filters HOT 4
- Missing release email for ack v3.7.0 HOT 1
- Filetype request: .txt filetype HOT 7
- Please support relative paths in --ignore-dir HOT 1
- Have a --noignore-file option HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ack3.