1
# DocumentId: $Id: change.func,v 1.6 2001/09/07 10:02:45 ola Exp $
2
# Author: $Author: ola $
3
# Date: $Date: 2001/09/07 10:02:45 $
5
# A change function to update a file using sed.
7
###############################################################################
9
# Description: Change a file using sed.
10
# Arguments: The sed script to use.
12
###############################################################################
16
if [ -f "$TMPFILE" ] ; then
17
cp -a $TMPFILE "$TMPFILE.tmp"
18
cat "$TMPFILE.tmp" | sed -e "$TMPSEDSC" > $TMPFILE
19
if [ -s $TMPFILE ] ; then
22
if [ ! -s $TMPFILE.tmp ] ; then
23
echo "The file $TMPFILE was cleared probably because of a error in the"
24
echo "sed script. Restoring from backup."
25
mv "$TMPFILE.tmp" $TMPFILE
29
echo "File $TMPFILE not found. So it is not possible to change it."