Closed fallalex closed 1 year ago
Thanks for the suggestion @fallalex
I will look into this.
I like the idea of adding support for something like the -p
mode of rargs, so commands of this form could work and run in parallel:
ls *.bak | rargs -p '(.*)\.bak' mv {0} {1}
cat download-list.csv | rargs -p '(?P<url>.*),(?P<filename>.*)' wget {url} -O {filename}
I think if -p
is specified:
{0}
{url}
etc would be replaced in each line before the command is run.Will start working on this as I have time.
Working on this in regex
branch
Released in version 1.7.1 today.
Add new -r / --regex option for regular expression capture group processing.
See the demos for examples: https://github.com/aaronriekenberg/rust-parallel/wiki/Demos#regular-expression
Thanks for adding this. Super excited for this feature! I am going to try replacing rargs and xargs with rust-parallel in my work flow!
Hi, thanks for the feature! ...but with the command having any other use of curly braces breaks completely, for example:
> echo 'input' | rust-parallel -r '.*' echo 'as json: {"id":123, "input":{0}}'
as json: }
I guess a good-enough fix would be to only consider references of format {[a-zA-Z0-9_]+}
(or something similar) and nothing else?
You are correct @jyrimatti ! Thanks for reporting this.
I created a new issue and will work on fixing this: https://github.com/aaronriekenberg/rust-parallel/issues/9
I would love to see the main feature of lotabout/rargs added to this tool. I could benefit from a combination of these two xarg alternatives. Avoiding output interleaving, improved performance, and regex groups from input passed to the target command would be fantastic for some powerful oneliners!