4 ms·
Compare with "gr what-is-it -r here-you-go". I do not have to remember all that argument hell.
by gladimdim 13y ago
Compare with "gr what-is-it -r here-you-go". I do not have to remember all that argument hell.
- anonymouz 13y agoWell, one can write an one-line shell alias (or script) instead of reinventing the wheel by rewriting the whole thing anew in Go. (Which is certainly good as learning experience for Go, but the end result is easier to achieve with the shell)
- piranha 13y agoWhen you start adding coloring, nice output, .hg/.gitignore support, it becomes just a big mess. Been there, done that.
- andreypopp 13y agocoloring is already supported by grep, .hg/.gitignore support is just a few lines
- piranha 13y agoJust do it then.
- dhamidi 13y agoProbably slower than the go version, but more flexible since you have more over the files processed. # bash # find/replace function fr { local pattern=$1 local replacement=$2 local program if [[ -z "$replacement" ]] then program="grep $pattern" else program="sed -i s/$pattern/$replacement/g" fi while read line do $program "$line" done } # usage find . | fr find-this find . | fr replace-this with-that
- peterwwillis 13y agoA C wrapper around `sed -e "s/what-is-it/here-you-go/" would be a little more efficient, and a lot simpler. Reinventing the wheel is bad for X+Y+Z reasons, where X, Y and Z are the bugs, options, and features in the last wheel.