-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgraveyard.sh
executable file
·60 lines (48 loc) · 981 Bytes
/
graveyard.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
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
count=`ls Pages/ | wc -l`
# Function for printing out the matrix
function printMatrix() {
f1="%$((${#count}+1))s"
f2=" %9s"
printf "$f1" ''
for ((i=1;i<=$count;i++)); do
printf "$f2" $i
done
echo
for ((j=1;j<=$count;j++)); do
printf "$f1" $j
for ((i=1;i<=$count;i++)); do
printf "$f2" ${matrix[$i,$j]}
done
echo
done
}
declare -a matrix
# Construct the Matrix
for ((i=1;i<=$count;i++)); do
for ((j=1;j<=$count;j++)); do
matrix[$i,$j]=$RANDOM
done
done
printMatrix
echo ${matrix[0,1]}
printMatrix
exit
#Parse text, filling in the matrix
for page in `ls Pages/*.html`; do
denom=`grep -c "link:to:*" $page`
links=`grep "link:to:*" $page`
col=${page:10:1}
echo $denom
echo
for link in $links; do
row=${link:12:1}
echo $row
echo $col
#matrix[$row,$col]=$(echo "scale=6; 1/$denom" |bc)
matrix[$row,$col]=1
done
done
printMatrix
# Matrix calculations
# Output Rank