forked from frankvalentine/OneLifeData7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
printContainerObjects.sh
executable file
·50 lines (32 loc) · 824 Bytes
/
printContainerObjects.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
for f in `ls -v objects/*`; do
if [[ $f == objects/*.txt ]] && ! [[ $f == objects/nextObjectNumber.txt ]];
then
name=$(cat $f | sed -n 2p );
containable=$(cat $f | sed -n 3p );
containSize=$(cat $f | sed -n 4p );
cont=$(echo $containable | grep -o -E '[01]' | head -1 );
containableSize=$(echo $containSize | grep -o -E '[0-9]' | head -1 );
numSlots=0;
slotSize=0;
while read -r line
do
if [[ $line == numSlots* ]];
then
numSlots=$(echo $line | grep -o -E '[0-9]' | head -1 );
fi
if [[ $line == slotSize* ]];
then
slotSize=$(echo $line | grep -o -E '[0-9]' | head -1 );
fi
done < $f
if (( $(bc <<< "$numSlots > 0") ))
then
echo -n -e "$name\n | $numSlots slots, size = $slotSize"
if (( $(bc <<< "$containable > 0") ))
then
echo -n -e "\n | containableSize = $containableSize"
fi
echo ""
fi
fi
done