From 46da44abbedc58b918fa78c022bde2afcdd3ef6e Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 5 Mar 2018 19:23:12 +0100 Subject: Add title page and word-count script --- update-count.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 update-count.sh (limited to 'update-count.sh') diff --git a/update-count.sh b/update-count.sh new file mode 100755 index 0000000..abc8d42 --- /dev/null +++ b/update-count.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +count-leaks () +{ + let pages=0 + let words=0 + + while read filename + do + let words+=$(wc -w ${filename} | cut -d' ' -f1) + let pages+=1 + done + + echo ${words} ${pages} +} + +read words pages < <(find . -name '*.md' | count-leaks) + +pattern="\([0-9]*\) words in \([0-9]*\) pages" +actual="${words} words in ${pages} pages" + +sed -i "s/${pattern}/${actual}/" index.md -- cgit v1.2.3