Retaining file permissions

Stuart Poulin stuart at amc-gw.amc.com
Thu Feb 28 05:22:04 AEST 1991


You can edit the file in place using ex and `here'.  Ex has options to
suppress it's informative output if you want (I think).

#!/bin/sh
File=$1
echo -n "From "
read FROM
echo -n "To "
read TO

ex $File <<!E!O!F!
g/$FROM/s//$TO/g
w
q
!E!O!F!

-----------------------------------------------------------------------
Stuart Poulin                             DNS: stuart at amc.com
Applied Microsystems Corporation         UUCP: amc-gw!stuart
Redmond, Washington  98073               Dial: 800-ASK-4AMC,206-882-2000 



More information about the Comp.unix.shell mailing list