retroforth/tools/retro-document.sh
crc f65e17727c housekeeping: rename some files in tools
FossilOrigin-Name: 1ca05b42f8833bb6327730255f6cdc9a3b0f9fe5939cbdef2d9fb9bb5adbbda5
2020-09-21 17:46:08 +00:00

21 lines
939 B
Bash
Executable file

#!/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' | grep -Ev "^[\\\^\.\"\@\!\$\`:&'#$.\(\|]" | sort | uniq | tr "\n" "\0" | xargs -0 -J % 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 -J % retro-describe | cat -s