mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
282 lines
5.8 KiB
Plaintext
282 lines
5.8 KiB
Plaintext
### Test {.} and {}
|
|
### Test {.} with files that have no . but dir does
|
|
/tmp/test-of-{.}-parallel/subdir/file
|
|
/tmp/test-of-{.}-parallel/subdir/file{.}
|
|
ls 1-col.diff|wc;echo 1-col.diff
|
|
1 1 11
|
|
1-col.diff
|
|
ls 1-col.txt|wc;echo 1-col.txt
|
|
1 1 10
|
|
1-col.txt
|
|
ls 2-col.diff|wc;echo 2-col.diff
|
|
1 1 11
|
|
2-col.diff
|
|
ls 2-col.txt|wc;echo 2-col.txt
|
|
1 1 10
|
|
2-col.txt
|
|
ls a|wc;echo a
|
|
6 6 41
|
|
a
|
|
ls b|wc;echo b
|
|
4 4 26
|
|
b
|
|
ls '中国 (Zhōngguó)'|wc;echo '中国 (Zhōngguó)'
|
|
4 12 118
|
|
中国 (Zhōngguó)
|
|
1 1-col.diff
|
|
1 1-col.txt
|
|
1 2-col.diff
|
|
1 2-col.txt
|
|
6 a
|
|
4 b
|
|
4 '中国 (Zhōngguó)'
|
|
1 1-col.diff
|
|
1 1-col.txt
|
|
1 2-col.diff
|
|
1 2-col.txt
|
|
6 a
|
|
4 b
|
|
4 '中国 (Zhōngguó)'
|
|
touch -- 1-col/abc-1-col-1-col
|
|
touch -- 1-col/abc-1-col-1-col.diff
|
|
touch -- 1-col/abc-1-col-1-col.txt
|
|
touch -- 2-col/abc-2-col-2-col
|
|
touch -- 2-col/abc-2-col-2-col.diff
|
|
touch -- 2-col/abc-2-col-2-col.txt
|
|
touch -- a/abc-a-a
|
|
touch -- b/abc-b-b
|
|
touch -- '中国 (Zhōngguó)'/abc-'中国 (Zhōngguó)'-'中国 (Zhōngguó)'
|
|
rm -- 1-col/abc-1-col-1-col
|
|
rm -- 1-col/abc-1-col-1-col.diff
|
|
rm -- 1-col/abc-1-col-1-col.txt
|
|
rm -- 2-col/abc-2-col-2-col
|
|
rm -- 2-col/abc-2-col-2-col.diff
|
|
rm -- 2-col/abc-2-col-2-col.txt
|
|
rm -- a/abc-a-a
|
|
rm -- b/abc-b-b
|
|
rm -- '中国 (Zhōngguó)'/abc-'中国 (Zhōngguó)'-'中国 (Zhōngguó)'
|
|
echo '### Test compress'
|
|
### Test compress
|
|
seq 5 | parallel -j2 --tag --compress 'seq {} | pv -q -L 10'
|
|
1 1
|
|
2 1
|
|
2 2
|
|
3 1
|
|
3 2
|
|
3 3
|
|
4 1
|
|
4 2
|
|
4 3
|
|
4 4
|
|
5 1
|
|
5 2
|
|
5 3
|
|
5 4
|
|
5 5
|
|
echo '### Test compress - stderr'
|
|
### Test compress - stderr
|
|
seq 5 | parallel -j2 --tag --compress 'seq {} | pv -q -L 10 >&2' 2>&1 >/dev/null
|
|
1 1
|
|
2 1
|
|
2 2
|
|
3 1
|
|
3 2
|
|
3 3
|
|
4 1
|
|
4 2
|
|
4 3
|
|
4 4
|
|
5 1
|
|
5 2
|
|
5 3
|
|
5 4
|
|
5 5
|
|
echo '### Test weird regexp chars'
|
|
### Test weird regexp chars
|
|
seq 1 6 | parallel -j1 -I :: -X echo a::b::^c::[.}c
|
|
a1b1^c1[.}c a2b2^c2[.}c a3b3^c3[.}c a4b4^c4[.}c a5b5^c5[.}c a6b6^c6[.}c
|
|
echo '### Test -m'
|
|
### Test -m
|
|
(echo foo;echo bar;echo joe.gif) | parallel -j1 -km echo 1{}2{.}3 A{.}B{.}C
|
|
1foo bar joe.gif2foo bar joe3 Afoo bar joeBfoo bar joeC
|
|
(echo foo;echo bar;echo joe.gif) | parallel -j1 -kX echo 1{}2{.}3 A{.}B{.}C
|
|
1foo2foo3 1bar2bar3 1joe.gif2joe3 AfooBfooC AbarBbarC AjoeBjoeC
|
|
seq 1 6 | parallel -k printf '{}.gif\\n' | parallel -j1 -km echo a{}b{.}c{.}
|
|
a1.gif 2.gif 3.gif 4.gif 5.gif 6.gifb1 2 3 4 5 6c1 2 3 4 5 6
|
|
seq 1 6 | parallel -k printf '{}.gif\\n' | parallel -j1 -kX echo a{}b{.}c{.}
|
|
a1.gifb1c1 a2.gifb2c2 a3.gifb3c3 a4.gifb4c4 a5.gifb5c5 a6.gifb6c6
|
|
echo '### Test -m with 10000 args'; seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -km echo a{}b{.}c{.} | tee >(wc; sleep 1) >(md5sum; sleep 1) >/dev/null; wait; sleep 1
|
|
### Test -m with 10000 args
|
|
c606aec1723ee5cc15f2a1b95d83d3cf -
|
|
echo '### Test -X with 10000 args and 5 expansions'
|
|
### Test -X with 10000 args and 5 expansions
|
|
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.}{.}{} | wc -l
|
|
3
|
|
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.}{.} | wc -l
|
|
2
|
|
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.} | wc -l
|
|
2
|
|
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c | wc -l
|
|
2
|
|
seq 10000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b | wc -l
|
|
1
|
|
echo '### Test {.} does not repeat more than {}'
|
|
### Test {.} does not repeat more than {}
|
|
seq 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -kX echo a{}b{.}c{.}
|
|
a1.gifb1c1 a2.gifb2c2 a3.gifb3c3 a4.gifb4c4 a5.gifb5c5 a6.gifb6c6
|
|
a7.gifb7c7 a8.gifb8c8 a9.gifb9c9 a10.gifb10c10 a11.gifb11c11 a12.gifb12c12
|
|
a13.gifb13c13 a14.gifb14c14 a15.gifb15c15
|
|
seq 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -km echo a{}b{.}c{.}
|
|
a1.gif 2.gif 3.gif 4.gif 5.gif 6.gif 7.gifb1 2 3 4 5 6 7c1 2 3 4 5 6 7
|
|
a8.gif 9.gif 10.gif 11.gif 12.gif 13.gifb8 9 10 11 12 13c8 9 10 11 12 13
|
|
a14.gif 15.gifb14 15c14 15
|
|
echo '### Test -I with shell meta chars'
|
|
### Test -I with shell meta chars
|
|
seq 10000 | parallel -j1 -I :: -X echo a::b::c:: | wc -l
|
|
2
|
|
seq 10000 | parallel -j1 -I '<>' -X echo 'a<>b<>c<>' | wc -l
|
|
2
|
|
seq 10000 | parallel -j1 -I '<' -X echo 'a<b<c<' | wc -l
|
|
2
|
|
seq 10000 | parallel -j1 -I '>' -X echo 'a>b>c>' | wc -l
|
|
2
|
|
echo '### Test {.}'
|
|
### Test {.}
|
|
echo a | parallel -qX echo "'"{.}"' "
|
|
'a'
|
|
echo a | parallel -qX echo "'{.}'"
|
|
'a'
|
|
(echo "sleep 3; echo begin"; seq 1 30 | parallel -kq echo "sleep 1; echo {.}"; echo "echo end") | parallel -k -j0
|
|
begin
|
|
1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
|
17
|
|
18
|
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
|
24
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30
|
|
end
|
|
echo '### Test -I with -X and -m'
|
|
### Test -I with -X and -m
|
|
seq 10 | parallel -k 'seq 1 {.} | 'parallel' -k -I :: echo {.} ::'
|
|
1 1
|
|
2 1
|
|
2 2
|
|
3 1
|
|
3 2
|
|
3 3
|
|
4 1
|
|
4 2
|
|
4 3
|
|
4 4
|
|
5 1
|
|
5 2
|
|
5 3
|
|
5 4
|
|
5 5
|
|
6 1
|
|
6 2
|
|
6 3
|
|
6 4
|
|
6 5
|
|
6 6
|
|
7 1
|
|
7 2
|
|
7 3
|
|
7 4
|
|
7 5
|
|
7 6
|
|
7 7
|
|
8 1
|
|
8 2
|
|
8 3
|
|
8 4
|
|
8 5
|
|
8 6
|
|
8 7
|
|
8 8
|
|
9 1
|
|
9 2
|
|
9 3
|
|
9 4
|
|
9 5
|
|
9 6
|
|
9 7
|
|
9 8
|
|
9 9
|
|
10 1
|
|
10 2
|
|
10 3
|
|
10 4
|
|
10 5
|
|
10 6
|
|
10 7
|
|
10 8
|
|
10 9
|
|
10 10
|
|
seq 10 | parallel -k 'seq 1 {.} | 'parallel' -j1 -X -k -I :: echo a{.} b::'
|
|
a1 b1
|
|
a2 b1 b2
|
|
a3 b1 b2 b3
|
|
a4 b1 b2 b3 b4
|
|
a5 b1 b2 b3 b4 b5
|
|
a6 b1 b2 b3 b4 b5 b6
|
|
a7 b1 b2 b3 b4 b5 b6 b7
|
|
a8 b1 b2 b3 b4 b5 b6 b7 b8
|
|
a9 b1 b2 b3 b4 b5 b6 b7 b8 b9
|
|
a10 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
|
|
seq 10 | parallel -k 'seq 1 {.} | 'parallel' -j1 -m -k -I :: echo a{.} b::'
|
|
a1 b1
|
|
a2 b1 2
|
|
a3 b1 2 3
|
|
a4 b1 2 3 4
|
|
a5 b1 2 3 4 5
|
|
a6 b1 2 3 4 5 6
|
|
a7 b1 2 3 4 5 6 7
|
|
a8 b1 2 3 4 5 6 7 8
|
|
a9 b1 2 3 4 5 6 7 8 9
|
|
a10 b1 2 3 4 5 6 7 8 9 10
|
|
echo '### Test -i'
|
|
### Test -i
|
|
(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{.}ce
|
|
replace
|
|
echo '### Test --replace'
|
|
### Test --replace
|
|
(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{.}ce
|
|
replace
|
|
echo '### Test -t'
|
|
### Test -t
|
|
(echo b; echo c; echo f) | parallel -k -t echo {.}ar 2>&1 >/dev/null
|
|
echo bar
|
|
echo car
|
|
echo far
|
|
echo '### Test --verbose'
|
|
### Test --verbose
|
|
(echo b; echo c; echo f) | parallel -k --verbose echo {.}ar 2>&1 >/dev/null
|
|
echo bar
|
|
echo car
|
|
echo far
|