1

I've been around *nix long enough to remember having done this in the past, and now those neural pathways are gone... I'm searching /usr/local/lib for files that contain img_convert because I'm getting a link error and want to find the library to include which contains that reference.

This command finds the reference, but doesn't print the containing file names:

$ strings /usr/local/lib/* | grep 'img_convert'
img_convert
img_convert

Of course, I could script this, however I'm sure there's a way to do this from the command line... so any help is appreciated!

2 Answers 2

3

Try

strings --print-file-name /usr/local/lib/* | grep 'img_convert'

Note that this will work with GNU strings, but not necessarily with other versions.

1
  • THANKS! On my particular flavor it was "--print-file-name".
    – Alan
    May 5, 2014 at 17:51
3

Grep is happy to read binary files and search for the string itself so

grep -l img_convert /usr/local/lib/* 

should do what you want.

1
  • WAT? grep speaks binary? thanks for the tip.
    – Alan
    May 5, 2014 at 17:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .