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 support for recursive search and replace #62
Comments
@jrmuizel not opposed to this at all, provided the feature request gains enough popularity |
In the meantime: |
I do |
Or use find/xargs:
|
Keeping within the RIIR toolchain, fd -X sd <find> <replace-with> {} ";" "\.md$" |
This is the issue with the most ':+1:' on this repository, so I think it's definitely popular 😄. Any chance this gets implemented? Maybe it's already implemented by #109, but I fail to see how it works if that's the case, |
I prefer...
|
This is a constant, constant sore spot of |
also, |
what are the risks |
set -x
f="/tmp/test/file name"
mkdir -p /tmp/test
cd /tmp/test
echo "old old" > "$f"
sd old new $(fd)
cat "$f" results in:
and of course quoting not to mention, if Relying on bash-y shells to deal with strings and globing is almost always unfortunate. |
Oh, thanks for that. I actually use fish, and that explains why I don't get that error. I made a bash example because it has a much larger user base. For fish, it is...
|
Of course I've commented here before. I also don't really know how to use this, without looking some shell invocation every single time, when the target directory has so many files that it's too many to pass as program arguments. this workaround feels like something, but it does work: #62 (comment) |
You can use fd to narrow the search to your chosen filetypes:
|
Nice @NoahTheDuke that's definitely a simpler construction that I have a chance of remembering. Thank you for noting it! |
Automatic recursive by default search/replace is what I expected after using ripgrep ( When I first tried However, an automatic recursive search and replace is also dangerous, especially with such a concise command syntax. This is where I would suggest that |
Windows Powershell workaround for missing xargs via filter: filter xargs { & $args[0] ($args[1..$args.length] + $_) } Usage: rg -l -F WeirdFnName | xargs sd WeirdFnName BetterFnName |
It would be nice to able to do a search and replace on an entire tree of files.
The text was updated successfully, but these errors were encountered: