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!

Alan
  • 541
  • 1
  • 6
  • 20

2 Answers2

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.

Sven
  • 98,649
  • 14
  • 180
  • 226
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.

user9517
  • 115,471
  • 20
  • 215
  • 297