shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
866 stars 63 forks source link

{%.}, {%:}, basename without extension is just {/.} in GNU parallel #3

Closed matrs closed 6 years ago

matrs commented 7 years ago

Hey, your software looks great, i'll use it soon. I just notice in the Readme/Documentation It says this isn't supported in GNU parallel, which I think isn't true (except that parallel only removes periods by default):

Combinations (Combinations of 3+ replacement strings not supported in GNU parallel):
{%.}, {%:}, basename without extension
{2.}, {2/}, {2%.}, manipulate nth field

The first is achieved in GNU parallel simply using {/.}. You can also manipulate as many nth fields as you want:

$ VAR1=/house/inthe/tree/plays.to.mo.rrow
$ VAR2=/hey/hop/hip
$ VAR3=/up/down/left.right
$ parallel  --plus "echo {2/} {1/..} {3.}" ::: $VAR1 ::: $VAR2 ::: $VAR3
hip plays.to /up/down/left

(With plus I also removed two periods from field {1})

shenwei356 commented 7 years ago

you're right. can you please help to submit a pull request, cause I can't have access to computer for 2 months.

ole-tange commented 7 years ago

It may be useful to look at this, too: https://www.gnu.org/software/parallel/parallel_alternatives.html#DIFFERENCES-BETWEEN-Rush-AND-GNU-Parallel

matrs commented 7 years ago

@shenwei356 sure, i'll submit it during the week, you have any special requirement/direction to do it?

shenwei356 commented 7 years ago

@matrs no any special requirement. Thank @ole-tange , author of GNU parallel, for providing more comparison detail.