Quote:
Originally Posted by Christoph Spohr
Try:
command:
Code:
for file in file11[0-3][0-9]2008
do
printf "%s\n\n" $(sed s'#.*11\(..\)2008#11/\1/2008#' <<< $file) >> logfile
grep "search_text" search/path/${file} >> LOG_FILE
done
HTH Chris
|
Chris, this outputs the search string of each file all into the logfile also, but it's not inserting the header or the blank line in the logfile (to separate the data according to the file they came from). Below is your code modified to the actual search criteria. Sorry about the change in path and file name values:
Code:
for file in event_demon.PRD.11[0-3][0-9]2008
do
printf "%s\n\n" $(sed s'#.*11\(..\)2008#11/\1/2008#' << $file) >> logfile
grep "sa_ZALE_REFMT_8" /autos/autotree/autouser/out/${file} >> LOG_FILE
done