Below are some common questions and answers covering some basics about files masks, search problems, multiple paths, printing, speeding up regular expression operations, licensing, etc. We will add additional items as necessary. If you have a problem that you can't solve from
the Search & Replace online help or a suggested addition for this FAQ please write us at support@funduc.com.
Q: How can I ignore carriage returns & find a string that might be on two lines.
A: There are two general tactics:
a) Regular Expression Mode: Separate multiple 'words' with *[ \r\n]. For
example, find*[ \r\n]this. If a fixed number of spaces is critical, use
*[\r\n]. \t (tabs) may be an issue if you are dealing with html or program
code (some editors use tabs to indent) so *[\r\n\t] may be necesssary.
b) Ignore Whitespace Mode: The search string find this will span from one
line to the next. Ignore Whitespace will not work with regular expression
mode. Also, there needs to be a space between the words. For example, 'findthis' is seen as a solid string and not something that can possibly
span across lines.
Q: I am running some operations from the command
line and want to specify a blank replace. But if I use /r alone, the
program specifies the last replacement string used instead of a blank.
A: We encourge users to employ scripts and specify references to
script files on the command line instead of using the command line to
specify the search and replace strings. Why? Because scripts free you
from having to deal with reserved characters for the OS command
processor. For example, specifying a literal | char on the command line
is difficult. But if you put the operation in a script you won't have to
worry coaxing a literal pipe char into your command line.
If you must specify the search and replace strings on the
command line and need to do a blank replace, make your operation a
regular expression mode operation and use /r\ for the replace. \ is the
'make literal' character when regular expression mode is on so this
results in a 'replace with nothing'.
Example: sr32 /s"find this" /r\ /x /i
The above finds find this and replaces with
nothing, case insensitive.
Q: I performed a search and get a report of "44 occurrences in 10 file(s)" found but when I do a replace I get "Replaced 10 occurrences in 10 file(s)". What's wrong.
A: Check Options|Search and disable 'Stop processing after first hit in file'. If you are using a script, make sure that setting is off in your script as well.
Q: The functionality of the /q command line switch and 'Quiet Mode' seems different in version 3.7. Please clarify.
A: Note: In newer versions the "Quiet Mode" setting can be made
in program options. Regarding version 3.7, a new command line switch - /u -
was added to disable the user interface. /u supplants
some of the 'quiet' nature that part of the /q switch in older versions. /q is now closer to 'quit' whereas in pre-3.7 older
versions /q meant 'quiet and quit'. If you need 'quiet' mode during
interactive use, see the Search and Replace
Configuration utility.
Q: I want to search
for files that contain a ' character but not if (copy or call)
is to '. Can I have multiple NOT conditions is a regular expression?
A: Try *!((copy|call)*'*). The program can
tolerate something like *!((copy|call))*'* but,
technically, the paren should surround the 'not' term. Multiple !'s can
also be specified. For example, *!(copy*'*)!(call*'*). This may be
easier than constructing | statements.
Q: When I double click on a file in the search results list Search and Replace does not use the Windows file association for that file type. It used to work but now it doesn't. What is wrong?
A: Search and Replace does not change your Windows file type
associations. However, the above symptoms suggest your association may have been disturbed, perhaps by the installation of another program. After consulting your operating system F1 hlp for information on file type
associations, if you agree with these steps, try: Go to the Windows Explorer, Folder Options menu for your OS (which Explorer menu it is under depends on the OS). Highlight the file type in question. Click on Edit (or Advanced in Win2K). Click on 'Set Default'. This will restore the all
commands for that file type to the default commands. The default commands were set up by the program or by Windows'.
Q: What are the limits on Search/Replace?
A: Available memory is an issue for searches and disk space for backup files (if enabled) is an issue for search/replace. For operations on a few thousand files the standard windows machine will be fine.
For larger operations, the more memory the better. If you have an operation involving many thousands of files and less than, say, 48 MB ram, consider breaking up the operation into smaller pieces via a script. NT is, understandably, more reliable for 'huge' operations than Win95/98.
Note: As of 05/20/99, the unofficial record for an unscripted, single pass search operation is 1,065,836 files searched, 27,307 occurrences found in 6,593 files. "SR" was hosted on a NT 4.0 SP3 machine with 128+MB ram. The search was across a LAN (speed unknown).
It took 8 days to complete.
Q. What is a file mask?
A. Is a way to specify many files of the same type. The wildcard characters * and ? are generally used to do so. For example: *.* will process all files (and if Search Subdirectories is checked, all the files in subdirectories too). *.htm;*.txt will process all files with an
.htm or .txt extension. For more information, please see the Search and Replace main dialog topic in the Help File where the File Mask field is described.
Q. I keep getting 0 files Searched. What am I doing wrong?
A. Make sure the Path is valid. You can do so by clicking the ... button and navigating to the directory you want. Also, make sure the files you are looking for really do exist. If you want to Search Subdirectories, check the box. If you are unsure of the mask, use
*.*.
Q. It won't find the string even though I know it is in this file.
A. First, ensure files are searched (see question above).
* If the string is still not found, make sure that a Regular Expression is not used unless you are familiar with that type of Search.
* If the Binary Mode dialog was used, please ensure that the \ character is doubled (\\).
* If you are unsure of the case of the string, turn Case Sensitive off.
* If all this still fails, please E-MAIL the file in question along with the exact string you are searching for, the operating system you use and the program's version to support@funduc.com.
Q. You say the program can handle multiple lines. How?
A. The Binary Mode dialogs, which are the [...] buttons next to the Search and Replace
fields, will take you to a dialog where you can either paste up to 32K of data to process or select special (binary) characters from a list.
Q: I want have a script I want to run from the NT 'at' scheduler. My script works OK when I test it but when run as an 'at' job I am told that the network path involved does not exist. What is going wrong.
A: There are several possibilities:
* Try using the '/interactive' switch with your 'at' command. This may help if memory management problems are affecting your 'at' scheduler jobs. Conversely, if you are using the /interactive switch, try taking it out.
* This may be due
to network permission issues and the AT scheduler. Some users have
found it necessary to include network logon commands in their
command script for the 'at' job. A larger issue is that, by default,
the schedule service on NT logs on as system account with restricted
network access. So when a cmd window is opened (by the AT command)
access to network drives may be denied. Solution: If you configure
the schedule service not as system service, but rather as one under
your own account, which has access to the network drive, you should
then have AT access those paths. You can configure this in the
services window in the system panel. Also search the MS Knowledge
Base for further information on the AT service. Some articles of
interest include: Q142432,
Q138340,
Q130668,
Q121562.
Your network administrator may need to configure your user account
with permission to launch the schedule service. Also have the
administrator verify that the network permissions for your user
account are passed along with permissions to launch the schedule
service. This probably happens automatically but run some tests
while you have your administrator's attention.
* Other users have found that it is necessary to include network logon commands in their script for the 'at' job.
Q: I am running TIDAL Software's Scheduler instead of the Windows scheduler. All is well with
the Windows scheduler but jobs under TIDAL Agent don't seem to run properly. Any ideas?
A: Mileage for your OS and TIDAL installation may vary but based on some detective work by another user, try enabling TIDAL Agent to run in foreground mode
instead of background mode. This is regardless of whether your Search and Replace routine uses any prompting or not. See your TIDAL
documentation for how to enable foreground mode.
Q: My problem
is similar to the above but it does not seem to be a permission issue
with the NT scheduler. Instead Search and Replace seems to simply not
complete the scripted task. I sometimes get an error message.
A: We have never seen this first hand but, by report, make sure
NT 4 SP6 is fully installed. Then install IE 5.5, which will upgrade to
the 'Task Scheduler'. The 'at' command works well for many users but the
Task Scheduler does seem to be more reliable overall.
Q: I did a
search, used my file manager on some files, and then I get an
"Error opening file..." message.
A: Turn off 'Cache File List' in Options-General.
Q: Version 2.94+ has 'Ignore Whitespace'. I want to change
<B>
<P><I>
and get them on to one line using Ignore Whitespace - the program help says extra spaces and \t\r\n are removed during a replacement when Ignore Whitepace is on. If have Ignore Whitespace checked but it won't even find the strings above.
A: Ignore Whitepace requires that at least one of the whitespace characters be present in the search string. Put a space in somewhere and it should work. For example,
Search: <B> <P><I>
Replace: <B><P><I>
Q. How can I replace line end characters (change HTML Text from UNIX to PC style and vice versa).
A. You can replace "!(\r)\n" to "\r\n" (to go from UNIX to DOS) and "\r\n" to "\n" (for the opposite) by checking Regular Expressions. You can also replace tabs by using "\t" to " " (you can use
more or less than 4 spaces). Again, this requires you to check the Regular Expression box (alternatively you can use Binary Mode).
Q: I have to modify some files not by replacing a known string with another but rather to replace a string of fixed length that is found at a specific offset in all the files. Can this be accomplished with Search and Replace?
A: If the offset is less than 4096 bytes, yes. Let's say you want to find a string 4 characters long at an offset of 1024. Turn off "Stop Processing After First Hit in File" under Options-Search to ensure that the program only searches for the occurrence.
The expressions:
Search: +1024[]????
Replace: %1rep_string
where
rep_string is your 4 character replacement string
would work.
Q. Can I process multiple paths?
A. Yes. You can create a Script which contains only the Paths and File Masks. Select 'Use Script' and then Search.
Q. Can I print the Search Results?
A. You can:
1. Select Print in the Edit or Context menu
2. Use LPT1 as the Output File Name
3. Specify an Output File Name, process the files, then use an editor (such as WordPad or Notepad) to load and print it.
Q: Can I rename
files via the File Operation function?
A: No. The internal file operations function is for basic
copy/move convenience only. Our Directory Toolkit or Explorer Extensions
utils are better suited for on-the-fly complex renaming. However, if you
are enterprising, and have a standard operation you perform regularly,
you can develop a series of Search and Replace scripts to rename (or
move/delete) files via a .bat routine.
The general tactic is: 1) An
initial script uses the output file function to get a list of files into
the output file. 2) A second (or more) script transforms the output from
step 1 into a working .bat file.
The specifics of setting this up
depend on what your original search consists of. As a general example,
say you have a series of files that contain the string find
me. You want to do a rename that appends _old to the prefix
of the original file name. These two scripts do the initial search to
collect the file names and then turn an output file into a working
.bat.
Scripts |
Explanation |
[Script for Search and Replace]
[Options]
Search_subdir=1
Output_File=d:\test\SR_Ren_do.bat
Append to output file=0
Show_Files=0
Before Hit=
After Hit=
Show Files Without Hits=0
Display Replace String=1
Display File Stats=0
Show File Date and Size=0
One hit=1
Cache File List=0
[Search /i]
find me
[Replace]
fut_comd %%srpath%%||||%%srfile%%
[Path]
d:\testfiles\*.txt
[End of Search and Replace Script]
|
Here
we do a case insensitive search for find me. Do not do a replace with this script!! It should be
run as a search-only. The goal is to get a dump
into the output file.
We don't care about how many hits are in each
file so One hit=1 tells the
program to just see if
the file contains find me. If so, search no further
&
move on to the next *.txt
file in the search path.
The path searched
is d:\testfiles\*.txt
for this
example.
The output is sent
to d:\test\SR_Ren_do.bat
Note the use of Append to output file=0.
We
want this file overwritten each time.
Note the use of Display Replace String=1
and
the replace string itself. The dump will list the
replace string. fut_comd
is used for convenience
later. Likewise, the ||||
characters make it easier
to parse the path and file name in the next step.
|
[Script for Search and Replace]
[Options]
Search_subdir=0
Prompt_flag=0
Output_File=
Show_Files=1
One hit=0
Cache File List=0
[Search /ix]
^fut_comd *||||*.*
[Replace]
ren "%2%3.%4" "%3_org.%4"
[Search /ix]
*!(ren )
[Replace]
rem %1
[Path]
d:\test\SR_Ren_do.bat
[End of Search and Replace Script]
|
This
script turns SR_Ren_do.bat above into a
working bat. Note that we reference that same
file as the [Path] in this script.
Output_File= should be blank like that. We don't
want to try and overwrite the same file we're s/r'ing.
Note the first s/r
operation. We look for all lines
that begin with fut_comd. The first * will find
the
path. The second * finds the file name. We need
to break that up because the ren command can't
have subdir specs in the <filename2> part. We put
" chars around them, just in case there are names
with spaces.
The second s/r looks for
all lines that do not begin
with the string 'ren ' and rem's them out. |
Q. How can I speed up regular expression searches?
A. Search & Replace is capable of processing huge files and some of our users are using it to do thousands of search & replace operations in a single program session. Depending on your hardware speed, the number and size of the files, and the complexity of your
procedure, some operations will inevitably take a while to complete. However, there are some things you can do to tweak as much speed as possible out of the program.
* Turn off 'Display First Hit Line' and 'Display Replace String' (Options-Output) if your operation results in many many hits. The Search Results List can become large. There is no reason to burden your machine, or the program, by
accumulating 100,000 lines in the Search Results List if you will not be looking at it anyway. Perhaps run a small test run first to confirm your operators and then turn off 'Display First Hit Line' and 'Display Replace String'?
* Under Options/Search, set the Maximum Regular Expression size to a lower value.
For large files &/or complex operations, a large setting for the Maximum Regular Expression size will slow the program down. There
are no special rules for how large or small the value should be so
use your best judgment and some test
searches. The Maximum Regular
Expression size is the number of bytes the program will 'span' from
the start of the search hit to the end. If none of your hits
involves material more than, say, 2000 bytes, then a Maximum
Regular Expression setting of 32000 is not needed.
* When possible, use anchors or literal characters in your expressions. For example, the expression "Win*" will be faster than "[Win]*".
* Under Options/Output, turn off Display First Hit Line and Display Replace String. If your operation involves thousands of search/replaces, this will save time by reducing the processing needed to generate the display (and output file, if any).
* Do you have "Search Subdirectories" and "Search ZIP Files" turned on. If not needed, turn them off. In some instances, it may be faster to run separate operations using sub-paths rather than a single operation with "Search Subdirectories" turned on.
* Set the file mask to find only the files you wish to process.
* Is it possible for you to break up huge files into smaller ones? A regular expression search & replace on a concatenated 40MB server log file spanning a week's worth of traffic will probably
take longer than separate search & replaces on individual log files for each day's traffic.
Q: Can Search and Replace search pdf files?
A: The program can search any file, including .exe's or dll's.
However, Search and Replace does not have a built in Acrobat viewer.
Acrobat pdf's are compressed and the text you see when looking in the
viewer does not exist as such in the raw file. Because of this Search
and Replace will likely not be of much use for searching pdfs.
Q. Do you give special discounts to religious or educational organizations?
A. Aside from quantity discounts available to everyone else, no.
Q. Can we put the software on a LAN?
A. Yes, provided you either:
* Use software limiting the maximum number of concurrent users and purchase as many licenses.
* Buy licenses for all LAN users.
Q: Do you have a version for Apple Macintosh computers?
A: No. By report our products work well under a W98 emulator software for Mac's. Give that a try.
Q: I have
Microsoft Word 97. Out of the blue my Word 97 Toolbar is issuing the message, "The application or DLL C:tools\sr\srext.dll is not a valid Windows NT image. Please check this against your installation diskette."
What is causing that?
A: This has been reported by two or three
users. The srext.dll file is the Search and Replace Explorer extension. Why the Office 97 Toolbar wants to deal with this file is unknown. Reinstalling the Search and Replace explorer shell extension seems to take care of the problem. The extension is available at any time from our web site.
Visit the shareware download page and
obtain the SRCLIENT.EXE download. Reboot your computer to make sure you have a fresh
boot and then run srclient.exe. Reboot again even if you are not prompted
to do so. This should take care of the problem.
|