Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
ted-datasets
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Mateusz Pawlik
ted-datasets
Commits
51a2eb55
Commit
51a2eb55
authored
Nov 16, 2017
by
Thomas Huetter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
statistics: added a script that outputs the min, max and average tree sizes of a given input file
parent
3113fb85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
statistics/nodes_per_tree.sh
statistics/nodes_per_tree.sh
+21
-0
No files found.
statistics/nodes_per_tree.sh
0 → 100755
View file @
51a2eb55
#!/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}'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment