Hey Everyone!
I have searched around for this on Unix.com and Google, and I'm either not phrasing my search properly or this is not as simple as I thought...
I have a script that runs on a nightly basis that pulls one field worth of data from an internal MySQL database and populates to an ASCII flat file at the system level. If you cat this file, looks like this:
KDJ
OPO
DE1
Also at the file system level from another process, I create log files that have {DATE}_{FIRSTFIELD} IE 10062009_KDJ, 10062009_OPO...
What I need to do is use "find" to search for all of the files that *contain* the 1st field reading from that ASCII flat file, basically, using some sort of array that pulls each field so that in one find command, I can get a list of files.
Using KornShell, I can achieve building a list from the flat file and printing:
#!/bin/ksh
I=1
for CODE in $(cat /logs/codes); do
CODES[$I]=$CODE
I=$((I + 1))
done
echo ${CODES[*]}
BUT how do I make use of $CODES placing in a wildcard "find" function like:
find /log/complete -name '*$CODES*' -print
where $CODES would look for any filename that contain *KDJ*,*OPO*, etc? It's like a seperate array would have to exist within the find search?
Thanks for any help:-) I'm pulling my hair out.