mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 05:57:54 +00:00
parallel: --plus {//regexp/str} replace every regexp with str.
This commit is contained in:
parent
d2753adec5
commit
2f85da8167
|
@ -2731,7 +2731,9 @@ sub init_globals() {
|
||||||
# Bash ${a%%def}
|
# Bash ${a%%def}
|
||||||
'{%%([^}]+?)}' => 's/$$1$//;',
|
'{%%([^}]+?)}' => 's/$$1$//;',
|
||||||
# Bash ${a/def/ghi} ${a/def/}
|
# Bash ${a/def/ghi} ${a/def/}
|
||||||
'{/([^}]+?)/([^}]*?)}' => 's/$$1/$$2/;',
|
'{/([^}/]+?)/([^}]*?)}' => 's/$$1/$$2/;',
|
||||||
|
# Bash ${a//def/ghi} ${a//def/}
|
||||||
|
'{//([^}]+?)/([^}]*?)}' => 's/$$1/$$2/g;',
|
||||||
# Bash ${a^a}
|
# Bash ${a^a}
|
||||||
'{^([^}]+?)}' => 's/^($$1)/uc($1)/e;',
|
'{^([^}]+?)}' => 's/^($$1)/uc($1)/e;',
|
||||||
# Bash ${a^^a}
|
# Bash ${a^^a}
|
||||||
|
|
|
@ -1953,7 +1953,8 @@ inspired by bash's parameter expansion:
|
||||||
{##regexp} remove prefix regexp (greedy)
|
{##regexp} remove prefix regexp (greedy)
|
||||||
{%regexp} remove postfix regexp (non-greedy)
|
{%regexp} remove postfix regexp (non-greedy)
|
||||||
{%%regexp} remove postfix regexp (greedy)
|
{%%regexp} remove postfix regexp (greedy)
|
||||||
{/regexp/str} replace regexp with str
|
{/regexp/str} replace one regexp with str
|
||||||
|
{//regexp/str} replace every regexp with str
|
||||||
{^str} uppercase str if found at the start
|
{^str} uppercase str if found at the start
|
||||||
{^^str} uppercase str
|
{^^str} uppercase str
|
||||||
{,str} lowercase str if found at the start
|
{,str} lowercase str if found at the start
|
||||||
|
|
|
@ -442,7 +442,7 @@ par_plus_dyn_repl() {
|
||||||
parallel --plus echo {2:-myval} ::: "wrong" ::: "$myvar" ::: "wrong"
|
parallel --plus echo {2:-myval} ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||||
parallel --plus echo {-2:-myval} ::: "wrong" ::: "$myvar" ::: "wrong"
|
parallel --plus echo {-2:-myval} ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||||
|
|
||||||
myvar=abcAaAdef
|
myvar=abcAaBdefCdefDdef
|
||||||
echo ${myvar:2}
|
echo ${myvar:2}
|
||||||
parallel --rpl '{:(\d+)} substr($_,0,$$1) = ""' echo {:2} ::: "$myvar"
|
parallel --rpl '{:(\d+)} substr($_,0,$$1) = ""' echo {:2} ::: "$myvar"
|
||||||
parallel --plus echo {:2} ::: "$myvar"
|
parallel --plus echo {:2} ::: "$myvar"
|
||||||
|
@ -488,6 +488,12 @@ par_plus_dyn_repl() {
|
||||||
parallel --plus echo {2/def/ghi} ::: "wrong" ::: "$myvar" ::: "wrong"
|
parallel --plus echo {2/def/ghi} ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||||
parallel --plus echo {-2/def/ghi} ::: "wrong" ::: "$myvar" ::: "wrong"
|
parallel --plus echo {-2/def/ghi} ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||||
|
|
||||||
|
echo ${myvar//def/ghi}
|
||||||
|
parallel --rpl '{//(.+?)/(.+?)} s/$$1/$$2/g;' echo {//def/ghi} ::: "$myvar"
|
||||||
|
parallel --plus echo {//def/ghi} ::: "$myvar"
|
||||||
|
parallel --plus echo {2//def/ghi} ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||||
|
parallel --plus echo {-2//def/ghi} ::: "wrong" ::: "$myvar" ::: "wrong"
|
||||||
|
|
||||||
echo ${myvar^a}
|
echo ${myvar^a}
|
||||||
parallel --rpl '{^(.+?)} s/^($$1)/uc($1)/e;' echo {^a} ::: "$myvar"
|
parallel --rpl '{^(.+?)} s/^($$1)/uc($1)/e;' echo {^a} ::: "$myvar"
|
||||||
parallel --plus echo {^a} ::: "$myvar"
|
parallel --plus echo {^a} ::: "$myvar"
|
||||||
|
|
|
@ -1605,54 +1605,59 @@ par_plus_dyn_repl myval
|
||||||
par_plus_dyn_repl myval
|
par_plus_dyn_repl myval
|
||||||
par_plus_dyn_repl myval
|
par_plus_dyn_repl myval
|
||||||
par_plus_dyn_repl myval
|
par_plus_dyn_repl myval
|
||||||
par_plus_dyn_repl cAaAdef
|
par_plus_dyn_repl cAaBdefCdefDdef
|
||||||
par_plus_dyn_repl cAaAdef
|
par_plus_dyn_repl cAaBdefCdefDdef
|
||||||
par_plus_dyn_repl cAaAdef
|
par_plus_dyn_repl cAaBdefCdefDdef
|
||||||
par_plus_dyn_repl cAaAdef
|
par_plus_dyn_repl cAaBdefCdefDdef
|
||||||
par_plus_dyn_repl cAaAdef
|
par_plus_dyn_repl cAaBdefCdefDdef
|
||||||
par_plus_dyn_repl cAa
|
par_plus_dyn_repl cAa
|
||||||
par_plus_dyn_repl cAa
|
par_plus_dyn_repl cAa
|
||||||
par_plus_dyn_repl cAa
|
par_plus_dyn_repl cAa
|
||||||
par_plus_dyn_repl cAa
|
par_plus_dyn_repl cAa
|
||||||
par_plus_dyn_repl cAa
|
par_plus_dyn_repl cAa
|
||||||
par_plus_dyn_repl 9
|
par_plus_dyn_repl 17
|
||||||
par_plus_dyn_repl 9
|
par_plus_dyn_repl 17
|
||||||
par_plus_dyn_repl 1
|
par_plus_dyn_repl 1
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl AaAdef
|
par_plus_dyn_repl AaBdefCdefDdef
|
||||||
par_plus_dyn_repl AaAdef
|
par_plus_dyn_repl AaBdefCdefDdef
|
||||||
par_plus_dyn_repl AaAdef
|
par_plus_dyn_repl AaBdefCdefDdef
|
||||||
par_plus_dyn_repl AaAdef
|
par_plus_dyn_repl AaBdefCdefDdef
|
||||||
par_plus_dyn_repl AaAdef
|
par_plus_dyn_repl AaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaA
|
par_plus_dyn_repl abcAaBdefCdefD
|
||||||
par_plus_dyn_repl abcAaA
|
par_plus_dyn_repl abcAaBdefCdefD
|
||||||
par_plus_dyn_repl abcAaA
|
par_plus_dyn_repl abcAaBdefCdefD
|
||||||
par_plus_dyn_repl abcAaA
|
par_plus_dyn_repl abcAaBdefCdefD
|
||||||
par_plus_dyn_repl abcAaA
|
par_plus_dyn_repl abcAaBdefCdefD
|
||||||
par_plus_dyn_repl abcAaAghi
|
par_plus_dyn_repl abcAaBghiCdefDdef
|
||||||
par_plus_dyn_repl abcAaAghi
|
par_plus_dyn_repl abcAaBghiCdefDdef
|
||||||
par_plus_dyn_repl abcAaAghi
|
par_plus_dyn_repl abcAaBghiCdefDdef
|
||||||
par_plus_dyn_repl abcAaAghi
|
par_plus_dyn_repl abcAaBghiCdefDdef
|
||||||
par_plus_dyn_repl abcAaAghi
|
par_plus_dyn_repl abcAaBghiCdefDdef
|
||||||
par_plus_dyn_repl AbcAaAdef
|
par_plus_dyn_repl abcAaBghiCghiDghi
|
||||||
par_plus_dyn_repl AbcAaAdef
|
par_plus_dyn_repl abcAaBghiCghiDghi
|
||||||
par_plus_dyn_repl AbcAaAdef
|
par_plus_dyn_repl abcAaBghiCghiDghi
|
||||||
par_plus_dyn_repl AbcAaAdef
|
par_plus_dyn_repl abcAaBghiCghiDghi
|
||||||
par_plus_dyn_repl AbcAaAdef
|
par_plus_dyn_repl abcAaBghiCghiDghi
|
||||||
par_plus_dyn_repl AbcAAAdef
|
par_plus_dyn_repl AbcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl AbcAAAdef
|
par_plus_dyn_repl AbcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl AbcAAAdef
|
par_plus_dyn_repl AbcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl AbcAAAdef
|
par_plus_dyn_repl AbcAaBdefCdefDdef
|
||||||
par_plus_dyn_repl AbcAAAdef
|
par_plus_dyn_repl AbcAaBdefCdefDdef
|
||||||
|
par_plus_dyn_repl AbcAABdefCdefDdef
|
||||||
|
par_plus_dyn_repl AbcAABdefCdefDdef
|
||||||
|
par_plus_dyn_repl AbcAABdefCdefDdef
|
||||||
|
par_plus_dyn_repl AbcAABdefCdefDdef
|
||||||
|
par_plus_dyn_repl AbcAABdefCdefDdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaAdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaAdef
|
||||||
par_plus_dyn_repl abcAaAdef
|
par_plus_dyn_repl abcAaAdef
|
||||||
|
|
Loading…
Reference in a new issue