I am writing a script that searches for various strings in various folders . I need to run multiple greps for the strings in the order they appear in the array .
The variable reading from the array is : ${STRINGS_2_SEARCH[$j]
It should be something like this in a loop :
find ${FOLDERS_2_SEARCH[$i]} -type f -name "*.*" | \ 
   xargs zegrep -i ${STRINGS_2_SEARCH[1]  | \
   xargs zegrep -i ${STRINGS_2_SEARCH[2] ....... | \
   xargs zegrep -i ${STRINGS_2_SEARCH[n]
The | xargs zegrep -i ${STRINGS_2_SEARCH[j] need to be substituted according to the number of strings to serch I added to the array .
Regards Raz
 
     
     
     
     
    