Global Search and Replace

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Global Search and Replace

Post by jussij »

Consider a situation where a global change needs to be made to a large number of files. One way to achieve this is to use the xfgrep utility to do the searching and the replace dialog to make the change.

As an example consider a case where "int" needs to be changed to "integer" for all c, cpp and h files found in the Zeus install directory. This is how it could be done:

(1) Make sure no files are open.

(2) Run the xfgrep utility using the Tools, DOS Command Line menu with these details

Arguments: xfgrep -d -f -n -l int *.c *.cpp *.h
Directory: $zd
For a description of the xfgrep arguments run fgrep -? from the the Tools, DOS Command Line menu

In this case the $zd is used as the working directory. The $zd macro tag will expand out to be the Zeus install directory.
(3) With the output window active use the Edit, Select All menu to highlight the xfgrep output.

(4) Use View, Open Include menu to load the files for editing.
The Open Include command normally searches the current line for a file name, but by selecting multiple lines it is possible to load several files at a time.
(5) Use the Edit, Replace menu to display the replace dialog and enter these details:

Find: int
Replace: integer
Match whole words checked
Match case sensitivity checked
All open documents yes
The All open documents option runs the search an replace for all currently open files.
(6) Use the File, Save All menu to save the global changes made.
Post Reply