#! /bin/csh set ARRAY = `awk '{print $3}' file2.cfg`; foreach p($ARRAY) grep $p file1.cfg > zieldatei.txt end