2010-04-13 21:44:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Test {.}
|
|
|
|
|
|
|
|
rsync -Ha --delete input-files/testdir2/ tmp/
|
|
|
|
cd tmp
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test {.} and {}'
|
2010-07-09 12:10:22 +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'
|
|
|
|
mkdir -p /tmp/test-of-{.}-parallel/subdir
|
|
|
|
touch /tmp/test-of-{.}-parallel/subdir/file
|
|
|
|
touch /tmp/test-of-{.}-parallel/subdir/file{.}.funkyextension}}
|
2010-07-09 12:10:22 +00:00
|
|
|
find /tmp/test-of-{.}-parallel -type f | parallel echo {.} | sort
|
2010-05-27 22:34:00 +00:00
|
|
|
rm -rf /tmp/test-of-{.}-parallel/subdir
|
|
|
|
|
|
|
|
|
2010-07-09 12:10:22 +00:00
|
|
|
find -type f | parallel -k diff {} a/foo ">"{.}.diff
|
2012-01-08 18:52:00 +00:00
|
|
|
ls | parallel -kv --group "ls {}|wc;echo {}"
|
2010-07-09 12:10:22 +00:00
|
|
|
ls | parallel -kj500 'sleep 1; ls {} | perl -ne "END{print $..\" {}\n\"}"'
|
2012-01-08 18:52:00 +00:00
|
|
|
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
|
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 ' '
|
2014-07-15 00:40:38 +00:00
|
|
|
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | nice parallel -vj0 -k -L1
|
2015-02-24 22:23:18 +00:00
|
|
|
echo '### bug #44358: 2 GB records cause problems for -N2'
|
|
|
|
(yes "`echo {1..100}`" | head -c 5000000000; echo FOO;
|
|
|
|
yes "`echo {1..100}`" | head -c 3000000000; echo FOO;
|
|
|
|
yes "`echo {1..100}`" | head -c 1000000000;) |
|
|
|
|
parallel --pipe --recend FOO'\n' -N2 --block 1g -k LANG=c wc -c
|
|
|
|
|
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'
|
2011-01-11 12:42:14 +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';
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' |
|
|
|
|
parallel -j1 -km echo a{}b{.}c{.} |
|
|
|
|
tee >(wc) >(md5sum) >/dev/null;
|
|
|
|
wait
|
|
|
|
|
|
|
|
echo '### Test -X with 60000 args';
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' |
|
|
|
|
parallel -j1 -kX echo a{}b{.}c{.} |
|
|
|
|
tee >(wc) >(md5sum) >/dev/null;
|
|
|
|
wait
|
|
|
|
|
2010-05-27 06:09:28 +00:00
|
|
|
echo '### Test -X with 60000 args and 5 expansions'
|
2011-01-11 12:42:14 +00:00
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -j1 -kX echo a{}b{.}c{.}{.}{} | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -j1 -kX echo a{}b{.}c{.}{.} | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -j1 -kX echo a{}b{.}c{.} | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -j1 -kX echo a{}b{.}c | wc -l
|
|
|
|
seq 1 60000 | perl -pe 's/$/.gif\n/' | parallel -j1 -kX echo a{}b | wc -l
|
2010-07-09 12:10:22 +00:00
|
|
|
echo '### Test {.} does not repeat more than {}'
|
2011-01-11 12:42:14 +00:00
|
|
|
seq 1 15 | perl -pe 's/$/.gif\n/' | parallel -j1 -s 80 -kX echo a{}b{.}c{.}
|
|
|
|
seq 1 15 | perl -pe 's/$/.gif\n/' | 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'
|
2011-01-11 12:42:14 +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 {.}'
|
2010-07-09 12:10:22 +00:00
|
|
|
echo a | parallel -qX echo "'"{.}"' "
|
|
|
|
echo a | parallel -qX echo "'{.}'"
|
2011-07-20 23:58:23 +00:00
|
|
|
(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'
|
2010-07-09 12:10:22 +00:00
|
|
|
seq 1 10 | parallel -k 'seq 1 {.} | 'parallel' -k -I :: echo {.} ::'
|
2011-01-11 12:42:14 +00:00
|
|
|
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'
|
2010-07-09 12:10:22 +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'
|
2010-07-09 12:10:22 +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'
|
2010-07-09 12:10:22 +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'
|
2010-07-09 12:10:22 +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
|