Loading statistics/nodes_per_tree.sh 0 → 100755 +21 −0 Original line number Diff line number Diff line #!/bin/bash # file: nodes_per_tree.sh # # usage: ./prepare_data.sh <inputfile> # # Program: Counts the number of nodes per line. Ouputs the maximal, # minimal and average number of nodes per line of the given # inputfile containing a tree in bracket notation per line. # # Author: Thomas Huetter if [ -z "$1" ] then echo "Argument missing." echo "Usage: ./prepare_data.sh <inputfile>" exit 1 fi awk -F '\{' '{print NF-1}' $1 | awk 'NR == 1 { max=$1; min=$1; sum=0 } { if ($1>max) max=$1; if ($1<min) min=$1; sum+=$1;} END {printf "Min: %d\tMax: %d\tAverage: %f\n", min, max, sum/NR}' Loading
statistics/nodes_per_tree.sh 0 → 100755 +21 −0 Original line number Diff line number Diff line #!/bin/bash # file: nodes_per_tree.sh # # usage: ./prepare_data.sh <inputfile> # # Program: Counts the number of nodes per line. Ouputs the maximal, # minimal and average number of nodes per line of the given # inputfile containing a tree in bracket notation per line. # # Author: Thomas Huetter if [ -z "$1" ] then echo "Argument missing." echo "Usage: ./prepare_data.sh <inputfile>" exit 1 fi awk -F '\{' '{print NF-1}' $1 | awk 'NR == 1 { max=$1; min=$1; sum=0 } { if ($1>max) max=$1; if ($1<min) min=$1; sum+=$1;} END {printf "Min: %d\tMax: %d\tAverage: %f\n", min, max, sum/NR}'