Re: find -ing all object files recursively: How to

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reuben D. Budiardja wrote
> 
> Hi all,
> I need some help here. I read manual, but am still not quite good with "find". 
> 
> How do I find all object files (*.o, *.a, *.so) recursively under the current 
> directory, and pass the result to "nm" so that I can get all the symbol of 
> all those object files?
> 
> So the problems are:
> 1. Find the object files recursively <-- not quite sure how to do this
> 2. pass the result to "nm". I can't figure this out, here is what I've  tried:
> 
> [rb@dev petsc-2.1.6]$ find -iname libpetscgsolver.a
> ./lib/libg/linux-gnu/libpetscgsolver.a
> 
> [rb@dev petsc-2.1.6]$ find -iname libpetscgsolver.a | nm -o
> nm: a.out: No such file or directory
> 
> So even when I pipe it to "nm", it wont accept it, why? I can do this however:
> 
> [rb@dev petsc-2.1.6]$ nm -o `find -iname libpetscgsolver.a`
> 
> with the backtick, but I'm not sure if that would work if the output of find 
> is more than one file.

find . -name '*.a' ... (other arguments to find) ... | xargs -i nm -o {}

I'm not sure what you're having trouble with wrt. the find command itself.
You may need multiple -o and -name options :

find . -name '*.o' -o -name '*.a' -o -name '*.so' | xargs -i nm -o {}

-justinb

-- 
Justin Banks
Constant Data, Inc.
http://www.constantdata.com


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux