[comp.sys.mac.programmer] MPW Search & Replace

isle@eleazar.dartmouth.edu (Ken Hancock) (08/16/90)

As our projects at work have steadily grown larger and larger, we
finally switched to MPW a while back.  Alas, I've been spoiled
by the THINK C environement and one of the things that MPW seems
to lack is a decent multi-file search and replace.  Does anyone
on the net have such a beast?

Donations of useful tools/scripts would be greatly appreciated.

Ken



-- 
Ken Hancock                   | This account needs a new home in MA...
Isle Systems                  | Can you provide a link for it?
isle@eleazar.dartmouth.edu    | It doesn't bite...  :-)

chewy@apple.com (Paul Snively) (08/16/90)

In article <23683@dartvax.Dartmouth.EDU> isle@eleazar.dartmouth.edu (Ken 
Hancock) writes:
> As our projects at work have steadily grown larger and larger, we
> finally switched to MPW a while back.  Alas, I've been spoiled
> by the THINK C environement and one of the things that MPW seems
> to lack is a decent multi-file search and replace.  Does anyone
> on the net have such a beast?

What's wrong with the Replace command?

Here is a useful (sometimes) variation on the theme:

For File in 'Files -f -o -r -s <SomeDirectorySpec>'
  Target "{File}"
  Find <option-8>
  Replace -c <option-5> /RegExp/ <string>
  Close -y "{Target}"
End

(Use your imagination to turn the above single-quotes into backquotes.)  
This will recursively enumerate everything in the DirectorySpec, Target 
it, Replace the RegExp with the string, and save the changes.

You can futz with the "Files" command in the above fragment to achieve 
other results, e.g. 'Files -t TEXT' will enumerate only text files, etc.

For a lot of applications, a variation using the Search command might be 
better.  Search will deal only with text files anyway, and returns a list 
of File... ; Line... commands which you might redirect to a temorary file 
and then iterate across and Evaulate, etc. to get at the match and futz 
with.

Hope this helps!

__________________________________________________________________________
                                Paul Snively
                      Macintosh Developer Technical Support
                             Apple Computer, Inc.

chewy@apple.com

Just because I work for Apple Computer, Inc. doesn't mean that I believe 
what they believe, or vice-versa.
__________________________________________________________________________