From 4bc3eec9fb26d367d174b103f77ccaa9175129ab Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 4 Aug 2017 12:48:11 +0200 Subject: avg-seg-len --- avg-seg-len | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 avg-seg-len (limited to 'avg-seg-len') diff --git a/avg-seg-len b/avg-seg-len new file mode 100755 index 0000000..ee68827 --- /dev/null +++ b/avg-seg-len @@ -0,0 +1,9 @@ +#!/usr/bin/env ruby + +lens = [] +while line = STDIN.gets + lens << line.strip.split.size +end + +puts lens.inject(:+)/lens.size.to_f + -- cgit v1.2.3