-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Miscellaneous feature suggestions #1061
Comments
(Update: added |
@okdana Thanks for pointing me to the discussion about |
You would make a script like this (call it
And then use it like:
|
As described, I don't think I understand how
This is another example where I was on the fence about a specific feature (
My stance on this is outlined here in #1008. It hasn't changed.
I don't think this is a good fit. I'd rather see folks write wrapper scripts or aliases if they want quick shortcuts for common patterns. It is much more flexible. Moreover, the I think the only thing in question here is the |
Could I please add to this and ask for an equivalent of the |
Please don't keep adding new feature requests to the same issue. To that end, @BatmanAoD, please do not open one issue for multiple distinct requests. @Snuggle The desired functionality already exists using literally the same flag: |
Thank you for the help, @BurntSushi, and apologies for thinking this issue was for multiple general feature requests. |
Sorry for the confusion on
|
For my "pre-packaged patterns" idea;
I suppose this isn't too difficult using
....the quoting is pretty awkward, though. |
Does |
I don't know what you're talking about, sorry. What relevance is your question too this specific issue? If there isn't any, then please open a new issue. Please include examples to help explain what you mean. |
sorry, my mistake, it means can I use |
ripgrep is a search tool. It is not a tool for removing duplicate lines. If
you don't care about order, then sort | uniq is the usual way to do that.
If you're having a problem with it, I'd recommend seeking help elsewhere
(like stackoverflow).
…On Fri, Nov 23, 2018, 21:15 cuongnv-ibl ***@***.*** wrote:
sorry, my mistake, it means can I use rg to remove duplicate lines in a
.txt file and save the new file as new.txt file.
alternative to sort myfile |uniq -u|tee newfile.txt
Because I tried use sort command but seem it doesn't work properly, some
duplicate lines still exist
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1061 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAb34m0MEZi5CE9DvWv8ZCQefPblFb5_ks5uyKvKgaJpZM4W0uLq>
.
|
These are just some ideas about what features I think would make a recursive-grep tool such as RipGrep more useful.
I've looked through the issues list (both open and closed) for any duplicates, and I did find one (which I deleted from my list), but otherwise I believe these are unique. If any of them are of interest, let me know if you'd like me to write up a separate tracking issue for them.
And if you think any of them would be reasonably straightforward to implement, perhaps I could help with that as well!
What version of ripgrep are you using?
0.10.0
How did you install ripgrep?
cargo
with thepcre2
feature, using Rust 1.29What operating system are you using ripgrep on?
Windows 10, "Fall creators update"
Describe your question, feature request, or bug.
--post
, comparable to--pre
; for each file, launch the specified command with the filename as an argument, and pipe the output from that file as inputreplace
and a bit of scripting, this would provide an easy and possibly more performant replacement forrg -l <pattern> | perl -pi -e 's/pattern/repl/g'
. It would also guarantee no surprise inconsistencies between RipGrep's and Perl's interpretations of<pattern>
(though in practice such inconsistencies are probably vanishingly rare), and could prevent typos from duplicating the pattern on the command line (though this can be avoided by creating a "recursive search-and-replace" shell function).Some way to provide arguments to a
--pre
(or--post
, if implemented) commandSome way to provide context about nearby lines, e.g. "do not match lines that have
<pattern>
in the previous line." This would probably be especially useful in conjunction with support more sophisticated boolean matching operations #875.A way to "pre-package" pattern elements. These could then be saved in the config file. For instance (adopting an arbitrary Perl-like syntax for the feature):
I'm honestly not sure that's an accurate representation of Windows paths yet, and it's already pretty hideous. It could be used as follows (again adopting an arbitrary syntax):
The text was updated successfully, but these errors were encountered: