From 72da2db3369869ed0b3f3fd8a33f6d0a1ab7a9d6 Mon Sep 17 00:00:00 2001 From: crc Date: Wed, 24 Apr 2019 14:16:37 +0000 Subject: [PATCH] add tools/document.sh FossilOrigin-Name: 0741ec3c06c4e8ce07487bf7471212750beb1cadd65f21572bf18c0ca7315c59 --- tools/document.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 tools/document.sh diff --git a/tools/document.sh b/tools/document.sh new file mode 100755 index 0000000..e2d55db --- /dev/null +++ b/tools/document.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# This is a quick and dirty shell script to extract the words +# in a source file and return the descriptions of them. +# +# Requirements: +# +# In your $PATH: +# +# - retro +# - retro-describe +# +# Usage: +# +# ./describe sourcefile + +# Extract | Split | Strip Blanks | Sort | Filter | Terminate | Generate | Strip Blanks +retro-unu $1 | tr " " "\n" | sed '/^[[:space:]]*$/d' | sort | uniq | tr "\n" "\0" | xargs -0 -n1 retro-describe | cat -s + +# Extract | Split | Strip Blanks | Get first | Sort | Filter | Find Prefixes | Generate word names | Terminate | Generate | Strip Blanks +retro-unu $1 | tr " " "\n" | sed '/^[[:space:]]*$/d' | cut -c1-1 | sort | uniq | grep "[\.\"\@\!\$\`:&'#$.\(\|]" | sed 's/^/prefix:/' | tr "\n" "\0" | xargs -0 -n1 retro-describe | cat -s