I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…
New(ish) command line tools
61–70 of 252 posts
Re: New(ish) command line tools
#62I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…
Previous discussion here: https://news.ycombinator.com/item?id=20455857
Also featured in that thread: https://github.com/akavel/up
For example: echo '' | fzf --print-query --preview 'grep -R {q} . 2> /dev/null'
Re: New(ish) command line tools
#63I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…
https://gist.github.com/b0o/f0759c84af6ef773a37a499fdb1c05af
Example: you’re trying to find a file that contains the strings “MIT License” (case insensitive), “npm install”, and a match for “react-.*” somewhere in your home directory:
aag ~ ---- -i "mit license" --- "npm install" --- "react-.*"
The excessive dashes are necessary so that it’s possible to pass different options to each separate invocation of ag.In case it’s not clear why this is useful, normally ag (or grep) searches are linewise. It’s not so easy if you are looking for things that occur on different lines, and possibly in different orders.
Re: New(ish) command line tools
#64No such list is complete without hexyl! https://github.com/sharkdp/hexyl
Re: New(ish) command line tools
#65I wrote dug, a cli tool I made to help visualize DNS propagation but is a great learning tool. Didnt make this list though sadly. https://github.com/unfrl/dug https://dug.unfrl.com
Seems your tweet was posted about the time the post was made? dug looks like it will be very useful, thank you
Re: New(ish) command line tools
#66Mosh isn't a replacement for SSH, it uses it. > The mosh client logs in to the server via SSH This is a cool list overall though.
Re: New(ish) command line tools
#67Re: New(ish) command line tools
#68Earlier quoted context omitted.
direnv should have been part of unix/linux/posix environments from the start. Whenever something's install steps tell you "go add this export statement to your .bashrc" or similar, it never sat well. That sort of thing should be scoped by path, and shell independent -- exactly the thing direnv enables.
I never understood why people were so enamored with direnv, but this makes me understand it a bit. I don't think I need it right now, but I'll keep it in mind for this use case.
Re: New(ish) command line tools
#69A simple trick I only figured recently is following logs with fuzzy search: tail -f /var/log/foo.log | fzf +s Or something similar for output from a dev server: make serve | fzf --ansi +s
Re: New(ish) command line tools
#70I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…
perl -ne '( /foo/ and /bar/ and !/baz/ and !/splat/ ) and print "$ARGV: $_"' *
I didn't include the context part, since that would be more than a one-liner, but it's not hard to do in a short script.