HTMLファイルをテキストにする

#!/bin/sh
#html2txt.sh

. f_askfname.sh
. f_askstring.sh

ask_filename "Taget File( Blank is Cancel. ): " 1
if [ $? -ne 0 ]; then
    echo "*** Canceled."
    return 1
fi
FILE1=${_STR}
echo "Target File is \"${FILE1}\""

ask_string "Save File [${FILE1}.txt]: " 1
if [ $? -ne 0 ]; then
    FILE2="${FILE1}.txt"
else
    FILE2=${_STR}
fi
echo "Save File is \"${FILE2}\""

#sed 's/<.*>//g' ${FILE1} |   #<で始まり>で終わる文字列を削除
sed 's/<[^>]*>//g' ${FILE1} | #
tr -d '[:blank:]' |           #空白を削除
cat -s > ${FILE2}             #複数の空白行を1つに
echo "*** Successful."
unset FILE1 FILE2 _STR
$ ./html2txt.sh 
Taget File( Blank is Cancel. ): 1.html
Target File is "1.html"
Save File [1.html.txt]: 
Save File is "1.html.txt"
*** Successful.

$ cat 1.html.txt

あんみのの備忘録