Shell Scripting Searches Library Function Name

STAGE 1: Get Library Path
# grep -r thread_data_base /app/* | tee grep_r_thread_data_base_app.log

STAGE 2: Get Library Searching Keyword.
#cat grep_r_thread_data_base_app.log | grep matches | grep so | awk ' { print $3 }' | awk  -F "/" '{ print $NF }' | awk -F "." ' { print $1 }' | cut -c 4-50 > search_keyword.log

STAGE 3: Search Successful Library Linking Path.
for i in `cat search_keyword.log`; do  a=`gcc -L/usr/lib64 -l$i 2>&1`;  if [[ "$a" != *cannot* ]]; then echo $i; fi; done

USEFUL HINTS
1)Print all the Filed except Last Column.
#awk -F "/" '{$NF=""; print $0}'
NF=Last Field.
2)gcc -L/usr/lib64 -lboost_thread-mt
gcc -L(SEARCHPATH) -lkeyword.
SOLUTION: for i in `cat search_keyword.log`; do  gcc -L/usr/lib64 -l$i;  done

3)How to save Command error message also to the particular variable.
a=`gcc -L/usr/lib64 -l$i 2>&1`;

4)if cased matches particular word of the variable statement.
if [[ "$a" == *is* ]]; then echo "match"; fi

5)for i in `cat search_keyword.log`;  //get Keyword
do 
a=`gcc -L/usr/lib64 -l$i 2>&1`;  //check Linking option.
if [[ "$a" != *cannot* ]]; //if it is not like "/usr/bin/ld: cannot find -lcomposerxe_boost_thread_1"
    then echo $i;      //then it will display the keyword.
fi;
done

Related post