#!/usr/bin/ksh
#Tag 0xFFFFFF11
#
# $Id: grex,v 1.2 1997/06/12 15:43:40 cm Exp $
#
# Copyright (C) Comunicacion Integral, Las Palmas de Gran Canaria, 1997
#
# $Log: grex,v $
# Revision 1.2  1997/06/12 15:43:40  cm
# general_update
#
# Revision 1.1  1997/06/12  13:21:15  cm
# Initial revision
#

if [ $# -lt "3" ]
then
	echo Usage : grex pattern replacement file
	exit
fi

pattern=$1
replacement=$2
if [ -f $3 ]
then
	file=$3
else
	echo $3 is not a file.
	exit
fi




for file in $*
do

    
if [ -r $file ] 
then
    echo "\t... Processing $file"
    touch aux
    A="`echo | tr '\012' '\001'`"
    sed -e "s$A$pattern$A$replacement$A" $file > aux
    rm $file
    cp aux $file
    rm aux
   
fi
       

done
