|
instead of using a zgrep ...try using a zcat as below
DIRECTORY=<Location where the files are located>
NEWDIR=<Desination folder>
for file in `ls -1 $DIRECTORY/*.Z`
do
LC=`zcat $file |head -1|grep "${STRING}"|wc -l`
if test $LC -eq 1
then
mv $file $NEWDIR/.
fi
done
|