#!/bin/csh -f

# Copies each file or standard input to standard output with all but alphanumerics removed.
# Also, first removes backslash followed by a single character to take out special characters represenations such as \n.

# Words are broken at * (due to detex behavior), -, _, /, ~, blank, and tab.

# Then any single capital letter followed by a period is removed.
# Also any lone ampersand is removed.

# Then terminal punctuation
# (" or '  or ) or ] or } or . or ! or ? or , or ; or :)
# is removed repeatedly.

# Then initial punctuation
# (" or `  or ( or [ or {)
# is removed repeatedly.

cat $* | sed 's+\\.++' | tr -c '[A-Za-z0-9]' ' '
