Hi ,
I want to find all Pro *C executables in a directory say /.
When i fire file command on Pro*c file it gives below o/p
ELF-64 executable object file - PA-RISC 2.0 (LP64)
my system is HP-UX eux012 B.11.23 U 9000/800 151107499 unlimited-user license
but when i fire file on a C executable it gives same kind of O/P
/bin/ls: PA-RISC1.1 shared executable dynamically linked -not stripped dynamically linked
is there a way of uniquely identifying all Pro *C executables i.e. grep soem O/P of file command
Thanks
Try the strings command, the SQL in there is stored as nul-terminated strings.
find /path -type f |
while read fname
do
strings $fname | egrep -iq '(select|delete|insert|update)' && echo $fname
done
This is not completely goof proof. It can return a false positive.
A better choice is to use ldd:
find /path -type f |
while read fname
do
ldd $fname | grep -q 'libclntsh' && echo $fname
done
Anything linked for Pro*C has to have that library.
I used both ,
fo 1st one i couldnt grep any select etc commands in strings O/P
my O/P is
strings PB2bTx_001
@(#) fml/libfml/fml32.h $Revision: 1.14 $
@(#) tuxedo/include/atmi.h $Revision: 1.29 $
@(#) gp/libgp/mach/hpux_ev.h $Revision: 1.12 $
@(#) fml/libfml/fml32.h $Revision: 1.14 $
@(#) tuxedo/include/atmi.h $Revision: 1.29 $
@(#) gp/libgp/mach/hpux_ev.h $Revision: 1.12 $
PB2bTs_ObjXEnt.pc
@(#) fml/libfml/fml32.h $Revision: 1.14 $
@(#) tuxedo/include/atmi.h $Revision: 1.29 $
@(#) gp/libgp/mach/hpux_ev.h $Revision: 1.12 $
//home/rahats/tuxtechlit/sql/FuncRNHistorySQL.pc
@(#) fml/libfml/fml32.h $Revision: 1.14 $
@(#) tuxedo/include/atmi.h $Revision: 1.29 $
@(#) gp/libgp/mach/hpux_ev.h $Revision: 1.12 $
)/home/rahats/tuxtechlit/sql/FuncRPOSQL.pc
for second one, i got below for ldd O/P
epq012{root}# ldd PB2bTx_001
PB2bTx_001:
Unable to find library 'tuxliboraxa.sl'.
this doesnt seem to work