1 .\" $NetBSD: qsubst.1,v 1.2 1999/09/04 17:07:23 perry Exp $
3 .\" This file is in the public domain.
9 .Nd query-replace strings in files
19 reads its options (see below) to get a list of files.
20 For each file on this list, it then replaces
24 wherever possible in that file, depending on user input (see below).
25 The result is written back onto the original file.
27 For each potential substitution found, the user is prompted with a few
28 lines before and after the line containing the string to be
30 The string itself is displayed using the terminal's standout mode, if any.
31 Then one character is read from the terminal.
32 This is then interpreted as follows (this is designed to be like Emacs'
33 query-replace-string):
34 .Bl -tag -width "space" -compact -offset indent
36 Replace this occurrence and go on to the next one.
38 Replace this occurrence and don't change any more in this file (i.e., go
41 Tentatively replace this occurrence.
42 The lines as they would look if the substitution were made are printed out.
43 Then another character is read and it is used to decide the result as if
44 the tentative replacement had not happened.
46 Don't change this one; just go on to the next one.
48 Don't change this one or any others in this file, but instead simply go
51 Change the rest in this file without asking, then go on to the next
52 file (at which point qsubst will start asking again).
54 Print out the current filename and ask again.
57 The first two arguments to qsubst are always the string to replace and
58 the string to replace it with.
59 The options are as follows:
60 .Bl -tag -width "-F filename" -compact -offset indent
62 The search string is considered as a C symbol; it must be bounded by
63 non-symbol characters.
71 Enter \&! mode automatically at the beginning of each file.
76 that is, ask as usual.
83 lines of context above and below the
84 line with the match when prompting the user.
91 lines of context above the line with the match when prompting the user.
98 lines of context below the line with the match when prompting the user.
102 argument is one of the files qsubst should perform substitutions in.
107 to get the names of files to perform substitutions in.
108 The names should appear one to a line.
111 The default amount of context is
113 that is, two lines above and two lines below the line with the match.
115 Arguments not beginning with a
117 sign in the options field are implicitly preceded by
121 is really needed only when the file name begins with a
126 reads its options in order and processes files as it gets them.
127 This means, for example, that a
129 will affect only files named after the
132 The most context you can get is ten lines each, above and below.
135 is limited to 512 characters; there is no limit on the size of
137 Neither one may contain a NUL.
139 NULs in the file may cause qsubst to make various mistakes.
141 If any other program modifies the file while qsubst is running, all
144 .An der Mouse Aq mouse@rodents.montreal.qc.ca