-
Notifications
You must be signed in to change notification settings - Fork 142
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
Feature request: ability to exit after one replacement #105
Comments
Why only the first? Maybe better - or somewhat "complete" - exit after m matches/replacements, default=1 |
@sklages, sure. I just meant to illustrate that this feature request originated from a specific, real-world situation of mine. |
So 687f3a5 has been merged, and has added a
|
It would be cool if the occurrence flag allowed a range, such that this becomes much easier: echo $'a\nb\nc\na\nb\nc' | sd -n 2, '(?m:\nb$)' '' | sd '^b$' 'B' To get back:
|
Great that -n max was added in v1.0.0 🎉 Note that the range suggestion (as teip does) has not been added: greymd/teip#27 For me, this is my use case that I want to simplify: |
I ran against this situation multiple times: I only need to search & replace the first occurrence of a pattern.
It'd be useful if
sd
allowed to exit gracefully after performing one replacement.There would be 2 benefits:
The text was updated successfully, but these errors were encountered: