-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmergeTrees.sh
More file actions
executable file
·30 lines (28 loc) · 921 Bytes
/
mergeTrees.sh
File metadata and controls
executable file
·30 lines (28 loc) · 921 Bytes
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
#!/bin/bash
fileToMerge=$1
nChunksToMerge=$2
inputDir=$3
runs=`cat $4`
for run in $runs; do
echo "Merging run $run --------------------------------"
chunks=`find $inputDir/$run/ -name $fileToMerge`
currentChunk=1
currentMergedChunk=1
buffer=""
for chunk in $chunks; do
buffer=`printf "$buffer\n$chunk"`
let "val=$currentChunk%$nChunksToMerge"
if [ $val -eq 0 ]; then
mkdir -p $inputDir/$run/chunk$currentMergedChunk
hadd $inputDir/$run/chunk$currentMergedChunk/$fileToMerge $buffer
buffer=""
let currentMergedChunk=currentMergedChunk+1
echo "================================================================="
fi
let currentChunk=currentChunk+1
done
if [ "$buffer" != "" ]; then
mkdir -p $inputDir/$run/chunk$currentMergedChunk
hadd $inputDir/$run/chunk$currentMergedChunk/$fileToMerge $buffer
fi
done