Cat with Binary File?
Hello,
I am trying to do some shell scripting to pull personal information out of an htm file. The command below worked fine on some of the files that I ran it on but I have a series of files that don't seem to fit the format.
The command...
cat newtest.htm | grep "mailto" >>test.txt
puts the text
Binary file (standard input) matches
in the test.txt file. I have no Idea how to correct this. I am a beginner at shell scripting so any additional information that could be provided would be greatly appreciated. Below is my entire script. Thanks for your help.
#Create Filelist
ls *.htm >>filelist.txt
exec < filelist.txt
read line
filename=$line
z='end'
echo $z >> filelist.txt
exec < filelist.txt
while [ ! "$line" = "$z" ]
do
exec < filelist.txt
read line
filename=$line
echo processing $filename
#cat file.html | grep "mailto:" > reduce.txt
##########Create HTML File Named DB.html
MAIL=$(grep "mailto:" $filename)
expr "$MAIL" : '.*mailto\:\(.*\)\".*' >>mail.txt
echo $MAIL >> db.html
echo -e "<BR>_______________________<BR>" >> db.html
echo -e "\n" >> db.html
rm newlist.txt
cat filelist.txt | grep -v $filename >> newlist.txt
rm filelist.txt
cat newlist.txt >> filelist.txt
exec < filelist.txt
read line
done
rm newlist.txt
rm filelist.txt
|