If you're on Unix/Linux/OS X et al, you could use sed, e.g. more file | sed 's|Type foo = Object (bar)|Type Tfoo = Class (Tbar)|' > newfile You'll need to nest this in a loop. In csh it'd be something like: foreach file (*.pas) ... end I think in bash you'd be after: for file in *.pas do ... done Hope this is enough to get you started -- good luck. I have my own small script to deal with filename expansion which avoids shell limits on the number of parameters, etc., which is why I forget exactly how the filename expansion loop things work. Grant
Hi
This isn't strictly a GPC question, but it is related, so I'll ask anyway :|
Is there an easy way to change a string in all source files to another string?
For example, if I want to change all occurrences of "Type foo = Object (bar)" to "Type Tfoo = Class (Tbar)" in all ".pas" and ".pp" files in a directory tree, is there an easy way to do it, using standard GNU tools? I could of course write a program to do it, but I figured there could be an easier way. Thanks.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
-- ------------------------------------------------------------------- Grant Jacobs Ph.D. BioinfoTools ph. +64 3 478 0095 (office, after 10am) PO Box 6129, or +64 27 601 5917 (mobile) Dunedin, gjacobs@bioinfotools.com NEW ZEALAND. Bioinformatics tools: deriving knowledge from biological data Bioinformatics tools - software development - consulting - training 15 years experience in bioinformatics ready to solve your problem Check out the website for more details: http://www.bioinfotools.com The information contained in this mail message is confidential and may be legally privileged. Readers of this message who are not the intended recipient are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify the sender immed- iately and destroy the original message. This applies also to any attached documents.