Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!convex!tchrist From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.shell Subject: Re: Retaining file permissions Keywords: chmod, sed, awk Message-ID: <1991Feb22.021821.29286@convex.com> Date: 22 Feb 91 02:18:21 GMT References: <6039@ptsfa.PacBell.COM> Sender: tchrist@convex.com (Tom Christiansen) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 27 From the keyboard of jlwestm@PacBell.COM (Jeff Westman): :I have a script that replaces a string with another. The file is executable, :but when I run it through 'sed' I loose the executable attribute -- and I :don't want to change my umask. : :Here's basically what I have: : : # Replace one occurance with another # Replace one occurance with occurrence :-) : : print "Enter a \"from\" string: \c" ; read FROM : print "Enter a \"to\" string: \c" ; read TO : : sed s/$FROM/$TO/gp $i > xyzyx : mv -f xyzyx $i % perl -p -i -e "s/$FROM/$TO/g" xyzyx Did you know that your set duplicates the lines matching $FROM? I assume this to be an error. --tom -- "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." -- Doug Gwyn Tom Christiansen tchrist@convex.com convex!tchrist Brought to you by Super Global Mega Corp .com