LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 02-26-2010, 01:57 PM   #1
Genjix
Member
 
Registered: Oct 2003
Location: Pico
Distribution: SUSE 9.1
Posts: 83

Rep: Reputation: 15
grep for http link in binary files


Hey,

grep -Rn domainnameofwebsite .

Binary file ./blaaA matches
Binary file ./blaaB matches
Binary file ./blaaC matches
Binary file ./blaaD matches
...

How can I get grep to output the entire link? Is there a way to have it show 20 characters forward from where it finds my search string?

Thanks
 
Old 02-26-2010, 02:08 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You might want to try something like
for httpfile in `ls .`
do echo "File is $httpfile and grep shows:"
strings $httpfile |grep domainnameofwebsite
done

The strings command looks for text in a binary and prints it out. (Of course it prints a lot of gobbledygook as well but your grep should restrict it to the information you want.
 
1 members found this post helpful.
Old 02-26-2010, 02:13 PM   #3
Genjix
Member
 
Registered: Oct 2003
Location: Pico
Distribution: SUSE 9.1
Posts: 83

Original Poster
Rep: Reputation: 15
thank you! that's amazing
 
  


Reply



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
How do i display binary files with grep ? LuciusHunt Programming 7 04-28-2008 05:53 PM
Display binary files using grep. LuciusHunt Programming 1 04-27-2008 08:48 AM
File upload in binary mode via HTTP saravanan1979 Programming 0 04-05-2002 01:48 AM

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

All times are GMT -5. The time now is 07:37 PM.

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