From 03e41234c31a98bc3503cf521aeb2d39e42508d0 Mon Sep 17 00:00:00 2001 From: Bruce Adams Date: Mon, 23 Sep 2013 19:48:18 -0400 Subject: [PATCH] Add a pipeline version written in Bourne shell --- 04-candy-factory/tf-04.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 04-candy-factory/tf-04.sh diff --git a/04-candy-factory/tf-04.sh b/04-candy-factory/tf-04.sh new file mode 100644 index 0000000..88c677c --- /dev/null +++ b/04-candy-factory/tf-04.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +grep -o "[A-Za-z][A-Za-z][A-Za-z]*" $1 \ + | tr '[:upper:]' '[:lower:]' \ + | grep -Ev "^($(sed -e 's/,/|/g' ../stop_words.txt))$" \ + | sort | uniq -c | sort -rn | head -25 \ + | sed -e 's/^ *\([0-9]*\) *\([a-z]*\)/\2 - \1/'