#!/bin/sh DIR=$1 cd ${DIR} find . -name '33dc01.*outer?log' -print | \ while read fn do tail +5 ${fn} > ${fn}.deleting mv ${fn}.deleting ${fn} done