tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY:how to make substitution in files
@ 2001-05-24 12:30 Jerry Brady
  0 siblings, 0 replies; only message in thread
From: Jerry Brady @ 2001-05-24 12:30 UTC (permalink / raw)
  To: tru64-unix-managers

Many thanks to:
Dr. Blinn
Bryan Dunlap
Bob Vickers
Kevin McDonnell
Nikola Milutinovic
Sreenivasa Prasad
Robert Mulley
Tom Webster

I recieved other responses that suggested I read the man page on sed.  My
problem was
that I did not know how to make sed put the change back into the orginal
file.  The people
listed above gave me many ways to do that in the korn shell and some perl
solutions.  I feel
like a kid in a candy store right now.  I will show you the korn shell
example and if you would
like to see the other ones send me an email and I will forward them to you.

for x in *
do
  echo $x
  sed -e 's/dst_prod/dst_test/g' $x > ${x}.new
  mv ${x}.new $x
done



here is one using the find command:

find . -type f -prune -exec grep -l dst_prod | while read f ; do
	sed 's/dst_prod/dst_test/g' $f > /var/tmp/$$ ; mv /var/tmp/$$ $f
	done
Again, thanks to all, this is the best mailing list!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-24 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-24 12:30 SUMMARY:how to make substitution in files Jerry Brady

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox