Application Synopsis Search/Replace Application Synopsis Version 4.1.0 for Win95/NT4.0 This Win95/NT4.0 Windows Search/Replace application was built to allow application developers, html writers, system/network administrators, and others to change multiple instances of a key word, phrase, sentence, or paragraph in many text files quickly and efficiently. It was designed to be used stand-alone by developers, administrators, HTML authors, et. al. who need to change a piece of information in multiple lines of many files located in multiple directories. It can also be wired it into the Microsoft C++ visual work bench through its Options/Tools menu to enrich the editing capability. Search/Replace allows you to: o define the search and replace strings or use previously defined strings; o search and replace across multiple lines new in Version 3.2; o display multiline search and replace results on multiple lines new in Version 3.4; o define search/replace strings up to 2000 characters new in Version 3.2; o define long search/replace strings using an extended edit dialog to accommodate up to 2000 characters new in Version 3.3; o define DOS file like wild cards in the search string new in Version 4.0; o use a set of special characters (discussed below) enhanced in Version 3.2; o define whether or not the search will be case sensitive (replace is always as entered); o define whether or not it must find the search string as a whole word or allow it to be embedded; o control whether the replace operation will be global or a confirmation is required for each replace (it will allow you to change from confirm each to global during the confirmation process plus other options); o automatically switches between a small and large query replace dialog (new in Version 4.1) for enhanced decision making during replace; o select one or more files you want it to search in one or more directories using an extended file dialog (all customers) or new in Version 3.0 to specify a starting directory and file filter and let the application add the qualifying files to the list (registered customers only); o define whether to replace all instances in a line or only the first; o define the file extensions you want to Always Search or Exclude (prompts you when it encounters an extension not on one of these two lists or allows you to add it to one of two additional lists which are search/exclude for this session only; o include an extension to search, for this session only, from its Always Exclude list; o define whether the files it searches conform to the UNIX file type rules for end-of-line (discussed below); o abort/stop in the middle of a replace session when confirm each is selected; o abort in the middle of a global replace session by double left clicking on a displayed line in the active window during a global replace; o control whether or not the back up file that is created to allow abort/restore is retained or automatically deleted; o control how to create the backup (by prepending a character to the existing extension or new in Version 3.1 by defining your own replacement back up extension); and o change from search/replace to insert a string at a specific column in every line of the files you select (discussed below). Search/Replace also: o remembers its last screen/toolbar position; o remembers the last drive/directory you searched; o allows you to define how many previous search/replace strings to remember; o allows you to close all open display windows with one button click (new in Version 4.1); o allows you to define the character it uses to create a backup of files it modifies or to define your own replacement extension; o allows you to define your own set of file type filters; o automatically adds filter extensions containing no wild card characters to Search This Session Only list when you define files via the Start Directory and File Filter method new in Version 3.4; o allows you to define an editor to launch and will launch that editor when you double left click on a file or file line at the conclusion of the search and replace operation; o allows you to print the results of the search and replace operation or save the results in a file; o allows you to define the printer font size (new in Version 4.1); o allows you to dictate the number of lines per page to print and whether of not to print the "not found in" files and related details new in Version 3.4; and o allows you to define how many spaces it will use to expand tabs. Display Limitation The application was designed to handle a huge number of files from multiple directories. There is a 128,000 line display limitation that will limit the number of files you can search and replace at one time. If 32 lines are modified per file (96 display lines), the file limitation is about 1,300 files. If no changes are made, the application can handle 128,000 files. The application will stop the search/replace operation when the display line limitation is reached. Search and replace strings are each limited to 2000 characters. Windows 95 Customers With Windows 95, I had hoped that the display limitations for list boxes et. al. would no longer be a concern. In fact, I assumed that, only to find out that I can only display 32767 lines in a list box. As a result, only 32000 lines are displayed per display frame. To overcome this limitation, I allow you to switch display frames using the Up (cyan) and Down (yellow) arrow buttons on the tool bar or selecting the Next/Previous Display Frame option from the View Menu. New in Version 4.0, you can now jump to a specific display page using the Right (green) arrow button on the toolbar. For those of you who running NT, forget this paragraph. Newline in Files Required The application expects to find newline characters, as a minimum, at the end of each line (text file) and will not process files that are not constructed in this manner. Files generated by word processors may or may not fall into this category unless they are saved in ASCII/text. When the application encounters such a file, it excludes the file from the session. Lists Maintained by Search/Replace Files are generally grouped by extension, and in today's environment, more than one type of file can have the same extension. As one example, Microsoft Word stores their files, by default, in non-text format using the doc extension while you or others may use the same extension to store files in text format. Search/Replace makes no assumptions about file types except for a few universal ones such as exe, com, etc. You may define the file extensions you do and do not want included in your search. You need not predefine the extensions, since the application will prompt you each time it encounters an extension it does not know about. The application keeps five (5) file extension lists which are Always Search, Always Exclude, Search This Session Only, Exclude This Session Only, and Override. Override allows you to include an always excluded extension for this session only. You may predefine the Always ... file extension types by selecting the Options menu and then the File Types tab. Back Ups are Automatic Any time a file is modified by the application, a backup file is generated that contains the original information. If you choose to Abort a search/replace operation, all files modified during the session up to the Abort point are restored (via the back ups) to their pre-session state. You may also decide, after the fact, that the changes made were not "as expected" and manually restore them yourself. By default, a tilde (~) is prepended to the original file's extension. If a tilde is not to your liking, you may change it to a valid DOS file name character of your choosing by selecting the Options menu and then the Back Ups tab. Alternately, you may define your own backup extension. The extension must be composed of valid DOS file name characters. Using this option, the characters beyond the last period are replaced with your backup extension. These back up files may optionally be automatically deleted at the conclusion of the search/replace operation by selecting No for the Retain Back Up option in the Back Ups tab. UNIX versus DOS File Types In today's networking environment, many files can be manipulated on foreign machines. The UNIX file type option is available for those who need to remotely alter text files that conform to the UNIX file standard. For those not familiar with UNIX vs DOS file types, UNIX saves files with just a newline (\n) while DOS saves files with a carriage return (\r)-newline(\n) combination to signify the end of the each line. The application can process both file types but by default expects the DOS carriage return-newline combination. If you are processing UNIX files, check the UNIX file types box. If not checked and the application detects a UNIX file type file, it will inform you and ask if you want to process it as a UNIX file type (new in version 3.2). This prompt can be annoying if you are processing a lot of UNIX files. If you specified the $ special character and a UNIX file is detected, you will not be given the opportunity switch to UNIX file processing since a \r\n is substituted for the $ character before any files are processed and it needs to be just the \n for UNIX (new in version 3.4). Be aware of the following: o files moved from a UNIX machine to your DOS machine may not contain the carriage return; and o some editors allow you to store files in UNIX format on your DOS machine. You can use this application to change the end-of-line marker in every line from one format to the other. Switching from Search/Replace to Insert At There have been times when I needed to insert a character or a character string at a specific column of every line in a data file and had to do it manually. As an added bonus, the application will do that for you if you check the Insert @ Column box in the Search/Replace Dialog. Instead of a search/replace application, the application magically changes to insert at a column. The search/replace string captions change as well as the functionality of its controls allowing you to define the character or string and the column (1 through 254 minus the insert string length) where you want it inserted. Be aware, that formerly blank lines will contain the inserted string at the specified column at the conclusion of the operation. The application handles long file names (256 characters max. for the total of the path, file name, and extension) as long as the files are located on your machine. If your network does not handle long file names without mangling, they will appear in the dialogs in 8.3 format.