You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to both print a highlighted version of the text a la rg --passthru ... and further process matches. Currently this needs two calls of rg. If --replace supported something like $1:$LINE, I could just run a cut -d: -f1 and cut -d: -f2-1 to get the data, with just one rg call. This should perform better if there are lots of non-matching lines? ... Anyways I think it's a good feature to have.
Perhaps a better option is to add --exec that execs a command? Sth in the spirit of --exec 'cp $1 ~/tmp'.
The text was updated successfully, but these errors were encountered:
NightMachinery
changed the title
[FR] Extend --replace to allow using the entire line as a variable
[FR] Extend --replace
May 21, 2020
@okdana That $0 should be added to the manpage. @BurntSushi The --replace functionality I wanted is this $0 which is already there. :)
The --exec flag would be something just like --replace, but instead of printing the output you call $SHELL -c $OUTPUT_HERE. It's actually pretty easy to implement since you have the --replace part down already.
BurntSushi
added
doc
An issue with or an improvement to documentation.
and removed
question
An issue that is lacking clarity on one or more points.
labels
May 22, 2020
I want to both print a highlighted version of the text a la
rg --passthru ...
and further process matches. Currently this needs two calls of rg. If--replace
supported something like$1:$LINE
, I could just run acut -d: -f1
andcut -d: -f2-1
to get the data, with just one rg call. This should perform better if there are lots of non-matching lines? ... Anyways I think it's a good feature to have.Perhaps a better option is to add
--exec
that execs a command? Sth in the spirit of--exec 'cp $1 ~/tmp'
.The text was updated successfully, but these errors were encountered: