diff options
-rw-r--r-- | parasort.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/parasort.sh b/parasort.sh new file mode 100644 index 0000000..6b54449 --- /dev/null +++ b/parasort.sh | |||
@@ -0,0 +1,20 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | trap ctrl_c INT | ||
4 | |||
5 | function ctrl_c() { | ||
6 | kill $(jobs -p) | ||
7 | echo "Killed." | ||
8 | } | ||
9 | |||
10 | cd output || exit 1 | ||
11 | mkdir -p ../sorted | ||
12 | |||
13 | for a in *[05]; do echo "$a" >&2; ../merge_entries $a > ../sorted/$a; done & | ||
14 | for a in *[16]; do echo " $a" >&2; ../merge_entries $a > ../sorted/$a; done & | ||
15 | for a in *[27]; do echo " $a" >&2; ../merge_entries $a > ../sorted/$a; done & | ||
16 | for a in *[38]; do echo " $a" >&2; ../merge_entries $a > ../sorted/$a; done & | ||
17 | for a in *[49]; do echo " $a" >&2; ../merge_entries $a > ../sorted/$a; done & | ||
18 | for a in brken *_; do echo " $a" >&2; ../merge_entries $a > ../sorted/$a; done & | ||
19 | |||
20 | wait | ||