Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get text strings from a binary file 1

Status
Not open for further replies.

jaxtell

Programmer
Sep 11, 2007
349
US
I am trying to figure out exactly what SQL statements an executable is running. I can view or grep the file to see the text, but there is a lot of it. Is there a good way to retrieve these string from a binary file? The closest I've gotten so far is
Code:
grep -i --binary-files=text "delete " FILENAME > delete.txt
But I still end up with loads of binary data. Ideally, I just want every match of the word delete followed by a space followed by a table name (letters and underscores) to end up as the results. I'd appreciate any advice you can offer. Thanks.

-----------------------------------------
I cannot be bought. Find leasing information at
 
Does strings work on your implementation?

The internet - allowing those who don't know what they're talking about to have their say.
 
Ah, yes it does. Knowing the right command makes things quite a bit easier. Thanks!

-----------------------------------------
I cannot be bought. Find leasing information at
 
This is what I ended up with
Code:
strings FILENAME | grep -i -o -P "delete [\W|_]+" > delete.txt

-----------------------------------------
I cannot be bought. Find leasing information at
 
Glad to help and thanks for the star!

The internet - allowing those who don't know what they're talking about to have their say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top