LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-06-2004, 03:12 PM   #1
Xaque208
LQ Newbie
 
Registered: Oct 2004
Location: United States
Distribution: Debian
Posts: 29

Rep: Reputation: 15
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
 
Old 12-06-2004, 07:59 PM   #2
Xaque208
LQ Newbie
 
Registered: Oct 2004
Location: United States
Distribution: Debian
Posts: 29

Original Poster
Rep: Reputation: 15
Lynx

I think I found something that I might be able to work with. I have been told that LYNX is the utility that I need to use to accomplish my task above. Is there any way to use regular expression with lynx to search a file on my local hard drive or have LYNX give me a different output format such as ascii, so I can still use the utility cat. Thank for you help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to redirect text to a file to cat at later point. says file doesn't exist. dr_zayus69 Programming 1 10-02-2005 08:10 AM
Printing a new file over the old file using cat mrobertson Programming 4 07-07-2005 10:18 AM
output to a file - cat? grep? Godsmacker777 Linux - Newbie 6 12-08-2004 10:06 AM
how to delete file created as cat > --vp manikanth04 Linux - General 2 10-03-2004 06:51 AM
bash: /bin/cat: cannot execute binary file inTUXicated Linux - General 9 08-06-2003 07:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration