From: "Campbell, Rolf [SKY:1U32:EXCH]" Newsgroups: comp.os.msdos.djgpp Subject: Re: Global file edit? Date: Thu, 05 Aug 1999 12:35:17 -0400 Organization: Nortel Networks Lines: 24 Message-ID: <37A9BD44.A2CF6CF2@americasm01.nt.com> References: <8D53104ECD0CD211AF4000A0C9D60AE301545D82 AT probe-2 DOT acclaim-euro DOT net> NNTP-Posting-Host: bmerhc00.ca.nortel.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.7 [en] (X11; I; HP-UX B.10.20 9000/712) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Shawn Hargreaves wrote: > A decent programming editor should have builtin support for > search/replace across multiple files. But if you need to do this > in a standalone form, try something like: > for file in $*; do > if [ -f $file ]; then > echo "Editing $file" > mv $file tmpfile > sed -e "s/$oldstring/$newstring/g" tmpfile > $file > touch -r tmpfile $file > rm tmpfile > else > echo "Error: $file not found" > fi > done What's the 'touch' line for? -- -Rolf Campbell (39)3-6318