Here is a simple idea..
first backup existing file as .backup
Replace and update file
Code:
#!/bin/bash
DIR="$1"
if [ $# -eq 0 ]; then
echo "$(basename $0) dir"
exit 1
fi
for f in $DIR/*
do
if [ ! -f $f.bakup ]; then
/bin/cp $f $f.backup
fi
out="/tmp/out.$$.tmp
cat $f | sed '/^$/d;s/^[ \t]*//;s/[ \t]*$//' > $out
/bin/mv $out $f
done
Try code in dummy setup; once okay; move to production.
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!
If you have knowledge, let others light their candles at it.
Certified to work on
HP-UX /
Sun Solaris /
RedHat