davex-mg-utils/utils/gen_help.sh
2017-09-15 09:55:29 -07:00

15 lines
296 B
Bash
Executable File

#!/bin/bash
if [ -z "$2" ]; then
echo "Usage: $0 infile outfile"
exit 1
fi
sed -n '/%help/,/%hend/p' "$1" | awk -F '; ' '{print $2}' | egrep -v '^%.+' | tr '\n' '\r' > "$2"
if [ -s "$2" ]; then
echo "Help file created."
else
echo "Help file missing or size zero."
rm -f "$2"
fi
exit 0