2010-04-13 21:44:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Test {.}
|
|
|
|
|
|
|
|
rsync -Ha --delete input-files/testdir2/ tmp/
|
|
|
|
cd tmp
|
|
|
|
|
2016-05-17 00:11:38 +00:00
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test {.} and {}'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
find . -name '*.jpg' | parallel -j +0 convert -geometry 120 {} {.}_thumb.jpg
|
2010-04-13 21:44:02 +00:00
|
|
|
|
2010-05-27 22:34:00 +00:00
|
|
|
echo '### Test {.} with files that have no . but dir does'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
mkdir -p /tmp/test-of-{.}-parallel/subdir;
|
|
|
|
touch /tmp/test-of-{.}-parallel/subdir/file;
|
|
|
|
touch /tmp/test-of-{.}-parallel/subdir/file{.}.funkyextension}};
|
|
|
|
find /tmp/test-of-{.}-parallel -type f | parallel echo {.} | sort;
|
|
|
|
rm -rf /tmp/test-of-{.}-parallel/subdir
|
2010-05-27 22:34:00 +00:00
|
|
|
|
|
|
|
|
2010-07-09 12:10:22 +00:00
|
|
|
find -type f | parallel -k diff {} a/foo ">"{.}.diff
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
ls | parallel -kv --group "ls {}|wc;echo {}"
|
|
|
|
ls | parallel -kj500 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"'
|
|
|
|
ls | parallel -kj500 --group 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"'
|
|
|
|
|
2010-04-13 21:44:02 +00:00
|
|
|
mkdir 1-col 2-col
|
2016-05-17 00:11:38 +00:00
|
|
|
|
2010-07-09 12:10:22 +00:00
|
|
|
ls | parallel -kv touch -- {.}/abc-{.}-{} 2>&1
|
|
|
|
ls | parallel -kv rm -- {.}/abc-{.}-{} 2>&1
|
|
|
|
#test05.sh:find . -type d -print0 | perl -0 -pe 's:^./::' | parallel -0 -v touch -- {}/abc-{}-{} 2>&1 \
|
|
|
|
#test05.sh:find . -type d -print0 | perl -0 -pe 's:^./::' | parallel -0 -v rm -- {}/abc-{}-{} 2>&1 \
|
|
|
|
#test05.sh:find . -type d -print0 | perl -0 -pe 's:^./::' | parallel -0 -v rmdir -- {} 2>&1 \
|
2011-07-20 23:58:23 +00:00
|
|
|
|
|
|
|
# -L1 will join lines ending in ' '
|
2016-05-17 00:11:38 +00:00
|
|
|
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj0 -k -L1 --joblog /tmp/jl-`basename $0`
|
2014-02-16 15:34:47 +00:00
|
|
|
echo '### Test compress'
|
|
|
|
seq 5 | parallel -j2 --tag --compress 'seq {} | pv -q -L 10'
|
|
|
|
|
|
|
|
echo '### Test compress - stderr'
|
|
|
|
seq 5 | parallel -j2 --tag --compress 'seq {} | pv -q -L 10 >&2' 2>&1 >/dev/null
|
|
|
|
|
|
|
|
echo '### Test weird regexp chars'
|
|
|
|
seq 1 6 | parallel -j1 -I :: -X echo a::b::^c::[.}c
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -m'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
(echo foo;echo bar;echo joe.gif) | parallel -j1 -km echo 1{}2{.}3 A{.}B{.}C
|
|
|
|
(echo foo;echo bar;echo joe.gif) | parallel -j1 -kX echo 1{}2{.}3 A{.}B{.}C
|
|
|
|
seq 1 6 | parallel -k printf '{}.gif\\n' | parallel -j1 -km echo a{}b{.}c{.}
|
|
|
|
seq 1 6 | parallel -k printf '{}.gif\\n' | parallel -j1 -kX echo a{}b{.}c{.}
|
2012-08-08 21:57:01 +00:00
|
|
|
|
|
|
|
echo '### Test -m with 60000 args';
|
2015-05-25 00:27:30 +00:00
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' |
|
2012-08-08 21:57:01 +00:00
|
|
|
parallel -j1 -km echo a{}b{.}c{.} |
|
2015-07-22 06:28:05 +00:00
|
|
|
tee >(wc; sleep 1) >(md5sum; sleep 1) >/dev/null;
|
|
|
|
wait;
|
|
|
|
sleep 1
|
2012-08-08 21:57:01 +00:00
|
|
|
|
|
|
|
echo '### Test -X with 60000 args';
|
2015-05-25 00:27:30 +00:00
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' |
|
2012-08-08 21:57:01 +00:00
|
|
|
parallel -j1 -kX echo a{}b{.}c{.} |
|
2015-07-22 06:28:05 +00:00
|
|
|
tee >(wc; sleep 1) >(md5sum; sleep 1) >/dev/null;
|
|
|
|
wait;
|
|
|
|
sleep 1
|
2012-08-08 21:57:01 +00:00
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -X with 60000 args and 5 expansions'
|
2016-05-17 00:11:38 +00:00
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.}{.}{} | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.}{.} | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c{.} | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b{.}c | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif/' | parallel -j1 -kX echo a{}b | wc -l
|
|
|
|
|
2010-07-09 12:10:22 +00:00
|
|
|
echo '### Test {.} does not repeat more than {}'
|
2010-05-27 06:09:28 +00:00
|
|
|
|
2016-05-17 00:11:38 +00:00
|
|
|
seq 1 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -kX echo a{}b{.}c{.}
|
|
|
|
seq 1 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -km echo a{}b{.}c{.}
|
|
|
|
seq 1 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -kX echo a{}b{.}c{.}
|
|
|
|
seq 1 15 | perl -pe 's/$/.gif/' | parallel -j1 -s 80 -km echo a{}b{.}c{.}
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -I with shell meta chars'
|
|
|
|
|
2016-05-17 00:11:38 +00:00
|
|
|
seq 1 60000 | parallel -j1 -I :: -X echo a::b::c:: | wc -l
|
|
|
|
seq 1 60000 | parallel -j1 -I '<>' -X echo 'a<>b<>c<>' | wc -l
|
|
|
|
seq 1 60000 | parallel -j1 -I '<' -X echo 'a<b<c<' | wc -l
|
|
|
|
seq 1 60000 | parallel -j1 -I '>' -X echo 'a>b>c>' | wc -l
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test {.}'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
echo a | parallel -qX echo "'"{.}"' "
|
|
|
|
echo a | parallel -qX echo "'{.}'"
|
|
|
|
(echo "sleep 3; echo begin"; seq 1 30 | parallel -kq echo "sleep 1; echo {.}"; echo "echo end") | parallel -k -j0
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -I with -X and -m'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
seq 1 10 | parallel -k 'seq 1 {.} | 'parallel' -k -I :: echo {.} ::'
|
|
|
|
seq 1 10 | parallel -k 'seq 1 {.} | 'parallel' -j1 -X -k -I :: echo a{.} b::'
|
|
|
|
seq 1 10 | parallel -k 'seq 1 {.} | 'parallel' -j1 -m -k -I :: echo a{.} b::'
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -i'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
(echo a; echo END; echo b) | parallel -k -i -eEND echo repl{.}ce
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test --replace'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
(echo a; echo END; echo b) | parallel -k --replace -eEND echo repl{.}ce
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -t'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
(echo b; echo c; echo f) | parallel -k -t echo {.}ar 2>&1 >/dev/null
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test --verbose'
|
2016-05-17 00:11:38 +00:00
|
|
|
|
|
|
|
(echo b; echo c; echo f) | parallel -k --verbose echo {.}ar 2>&1 >/dev/null
|
2011-07-20 23:58:23 +00:00
|
|
|
EOF
|