Grant Jacobs wrote:
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
BTW, more is a pager. It will usually just write out the file when used in a pipe, but that's kind of a misuse. Usually one would use cat instead, or input redirection (sed < file), or simply an argument (for sed, as sed accepts input file name arguments, i.e. sed 's...' file).
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.
Looks right. BTW, if size limitations are a concern (i.e., rather many files), then the find | xargs combination is often useful, as I wrote in my other mail. xargs will group the arguments up to the limits the system can handle and call the program (in my case, the script) as often as necessary.
Frank