xref: /openbsd-src/gnu/usr.bin/binutils/gdb/doc/inc-hist.texinfo (revision 52ba75afc58e22d57c4ccd2f6520324ef30c24b6)
1*52ba75afSkettenis@ignore
2*52ba75afSkettenisThis file documents the user interface to the GNU History library.
3*52ba75afSkettenis
4*52ba75afSkettenisCopyright (C) 1988-2002 Free Software Foundation, Inc.
5*52ba75afSkettenisAuthored by Brian Fox and Chet Ramey.
6*52ba75afSkettenis
7*52ba75afSkettenisPermission is granted to make and distribute verbatim copies of this manual
8*52ba75afSkettenisprovided the copyright notice and this permission notice are preserved on
9*52ba75afSkettenisall copies.
10*52ba75afSkettenis
11*52ba75afSkettenisPermission is granted to process this file through Tex and print the
12*52ba75afSkettenisresults, provided the printed document carries copying permission notice
13*52ba75afSkettenisidentical to this one except for the removal of this paragraph (this
14*52ba75afSkettenisparagraph not being relevant to the printed manual).
15*52ba75afSkettenis
16*52ba75afSkettenisPermission is granted to copy and distribute modified versions of this
17*52ba75afSkettenismanual under the conditions for verbatim copying, provided also that the
18*52ba75afSkettenisGNU Copyright statement is available to the distributee, and provided that
19*52ba75afSkettenisthe entire resulting derived work is distributed under the terms of a
20*52ba75afSkettenispermission notice identical to this one.
21*52ba75afSkettenis
22*52ba75afSkettenisPermission is granted to copy and distribute translations of this manual
23*52ba75afSkettenisinto another language, under the above conditions for modified versions.
24*52ba75afSkettenis@end ignore
25*52ba75afSkettenis
26*52ba75afSkettenis@node Using History Interactively
27*52ba75afSkettenis@chapter Using History Interactively
28*52ba75afSkettenis
29*52ba75afSkettenisThis chapter describes how to use the @sc{gnu} History Library
30*52ba75afSkettenisinteractively, from a user's standpoint.
31*52ba75afSkettenisIt should be considered a user's guide.
32*52ba75afSkettenisFor information on using the @sc{gnu} History Library in other programs,
33*52ba75afSkettenissee the @sc{gnu} Readline Library Manual.
34*52ba75afSkettenis
35*52ba75afSkettenis@ifset BashFeatures
36*52ba75afSkettenis@menu
37*52ba75afSkettenis* Bash History Facilities::	How Bash lets you manipulate your command
38*52ba75afSkettenis				history.
39*52ba75afSkettenis* Bash History Builtins::	The Bash builtin commands that manipulate
40*52ba75afSkettenis				the command history.
41*52ba75afSkettenis* History Interaction::		What it feels like using History as a user.
42*52ba75afSkettenis@end menu
43*52ba75afSkettenis@end ifset
44*52ba75afSkettenis@ifclear BashFeatures
45*52ba75afSkettenis@menu
46*52ba75afSkettenis* History Interaction::		What it feels like using History as a user.
47*52ba75afSkettenis@end menu
48*52ba75afSkettenis@end ifclear
49*52ba75afSkettenis
50*52ba75afSkettenis@ifset BashFeatures
51*52ba75afSkettenis@node Bash History Facilities
52*52ba75afSkettenis@section Bash History Facilities
53*52ba75afSkettenis@cindex command history
54*52ba75afSkettenis@cindex history list
55*52ba75afSkettenis
56*52ba75afSkettenisWhen the @option{-o history} option to the @code{set} builtin
57*52ba75afSkettenisis enabled (@pxref{The Set Builtin}),
58*52ba75afSkettenisthe shell provides access to the @dfn{command history},
59*52ba75afSkettenisthe list of commands previously typed.
60*52ba75afSkettenisThe value of the @env{HISTSIZE} shell variable is used as the
61*52ba75afSkettenisnumber of commands to save in a history list.
62*52ba75afSkettenisThe text of the last @env{$HISTSIZE}
63*52ba75afSketteniscommands (default 500) is saved.
64*52ba75afSkettenisThe shell stores each command in the history list prior to
65*52ba75afSkettenisparameter and variable expansion
66*52ba75afSkettenisbut after history expansion is performed, subject to the
67*52ba75afSkettenisvalues of the shell variables
68*52ba75afSkettenis@env{HISTIGNORE} and @env{HISTCONTROL}.
69*52ba75afSkettenis
70*52ba75afSkettenisWhen the shell starts up, the history is initialized from the
71*52ba75afSkettenisfile named by the @env{HISTFILE} variable (default @file{~/.bash_history}).
72*52ba75afSkettenisThe file named by the value of @env{HISTFILE} is truncated, if
73*52ba75afSkettenisnecessary, to contain no more than the number of lines specified by
74*52ba75afSkettenisthe value of the @env{HISTFILESIZE} variable.
75*52ba75afSkettenisWhen an interactive shell exits, the last
76*52ba75afSkettenis@env{$HISTSIZE} lines are copied from the history list to the file
77*52ba75afSkettenisnamed by @env{$HISTFILE}.
78*52ba75afSkettenisIf the @code{histappend} shell option is set (@pxref{Bash Builtins}),
79*52ba75afSkettenisthe lines are appended to the history file,
80*52ba75afSkettenisotherwise the history file is overwritten.
81*52ba75afSkettenisIf @env{HISTFILE}
82*52ba75afSkettenisis unset, or if the history file is unwritable, the history is
83*52ba75afSkettenisnot saved.  After saving the history, the history file is truncated
84*52ba75afSkettenisto contain no more than @env{$HISTFILESIZE}
85*52ba75afSkettenislines.  If @env{HISTFILESIZE} is not set, no truncation is performed.
86*52ba75afSkettenis
87*52ba75afSkettenisThe builtin command @code{fc} may be used to list or edit and re-execute
88*52ba75afSkettenisa portion of the history list.
89*52ba75afSkettenisThe @code{history} builtin may be used to display or modify the history
90*52ba75afSkettenislist and manipulate the history file.
91*52ba75afSkettenisWhen using command-line editing, search commands
92*52ba75afSkettenisare available in each editing mode that provide access to the
93*52ba75afSkettenishistory list (@pxref{Commands For History}).
94*52ba75afSkettenis
95*52ba75afSkettenisThe shell allows control over which commands are saved on the history
96*52ba75afSkettenislist.  The @env{HISTCONTROL} and @env{HISTIGNORE}
97*52ba75afSkettenisvariables may be set to cause the shell to save only a subset of the
98*52ba75afSketteniscommands entered.
99*52ba75afSkettenisThe @code{cmdhist}
100*52ba75afSkettenisshell option, if enabled, causes the shell to attempt to save each
101*52ba75afSkettenisline of a multi-line command in the same history entry, adding
102*52ba75afSkettenissemicolons where necessary to preserve syntactic correctness.
103*52ba75afSkettenisThe @code{lithist}
104*52ba75afSkettenisshell option causes the shell to save the command with embedded newlines
105*52ba75afSkettenisinstead of semicolons.
106*52ba75afSkettenisThe @code{shopt} builtin is used to set these options.
107*52ba75afSkettenis@xref{Bash Builtins}, for a description of @code{shopt}.
108*52ba75afSkettenis
109*52ba75afSkettenis@node Bash History Builtins
110*52ba75afSkettenis@section Bash History Builtins
111*52ba75afSkettenis@cindex history builtins
112*52ba75afSkettenis
113*52ba75afSkettenisBash provides two builtin commands which manipulate the
114*52ba75afSkettenishistory list and history file.
115*52ba75afSkettenis
116*52ba75afSkettenis@table @code
117*52ba75afSkettenis
118*52ba75afSkettenis@item fc
119*52ba75afSkettenis@btindex fc
120*52ba75afSkettenis@example
121*52ba75afSkettenis@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
122*52ba75afSkettenis@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
123*52ba75afSkettenis@end example
124*52ba75afSkettenis
125*52ba75afSkettenisFix Command.  In the first form, a range of commands from @var{first} to
126*52ba75afSkettenis@var{last} is selected from the history list.  Both @var{first} and
127*52ba75afSkettenis@var{last} may be specified as a string (to locate the most recent
128*52ba75afSketteniscommand beginning with that string) or as a number (an index into the
129*52ba75afSkettenishistory list, where a negative number is used as an offset from the
130*52ba75afSketteniscurrent command number).  If @var{last} is not specified it is set to
131*52ba75afSkettenis@var{first}.  If @var{first} is not specified it is set to the previous
132*52ba75afSketteniscommand for editing and @minus{}16 for listing.  If the @option{-l} flag is
133*52ba75afSkettenisgiven, the commands are listed on standard output.  The @option{-n} flag
134*52ba75afSkettenissuppresses the command numbers when listing.  The @option{-r} flag
135*52ba75afSkettenisreverses the order of the listing.  Otherwise, the editor given by
136*52ba75afSkettenis@var{ename} is invoked on a file containing those commands.  If
137*52ba75afSkettenis@var{ename} is not given, the value of the following variable expansion
138*52ba75afSkettenisis used: @code{$@{FCEDIT:-$@{EDITOR:-vi@}@}}.  This says to use the
139*52ba75afSkettenisvalue of the @env{FCEDIT} variable if set, or the value of the
140*52ba75afSkettenis@env{EDITOR} variable if that is set, or @code{vi} if neither is set.
141*52ba75afSkettenisWhen editing is complete, the edited commands are echoed and executed.
142*52ba75afSkettenis
143*52ba75afSkettenisIn the second form, @var{command} is re-executed after each instance
144*52ba75afSkettenisof @var{pat} in the selected command is replaced by @var{rep}.
145*52ba75afSkettenis
146*52ba75afSkettenisA useful alias to use with the @code{fc} command is @code{r='fc -s'}, so
147*52ba75afSkettenisthat typing @samp{r cc} runs the last command beginning with @code{cc}
148*52ba75afSkettenisand typing @samp{r} re-executes the last command (@pxref{Aliases}).
149*52ba75afSkettenis
150*52ba75afSkettenis@item history
151*52ba75afSkettenis@btindex history
152*52ba75afSkettenis@example
153*52ba75afSkettenishistory [@var{n}]
154*52ba75afSkettenishistory -c
155*52ba75afSkettenishistory -d @var{offset}
156*52ba75afSkettenishistory [-anrw] [@var{filename}]
157*52ba75afSkettenishistory -ps @var{arg}
158*52ba75afSkettenis@end example
159*52ba75afSkettenis
160*52ba75afSkettenisWith no options, display the history list with line numbers.
161*52ba75afSkettenisLines prefixed with a @samp{*} have been modified.
162*52ba75afSkettenisAn argument of @var{n} lists only the last @var{n} lines.
163*52ba75afSkettenisOptions, if supplied, have the following meanings:
164*52ba75afSkettenis
165*52ba75afSkettenis@table @code
166*52ba75afSkettenis@item -c
167*52ba75afSkettenisClear the history list.  This may be combined
168*52ba75afSketteniswith the other options to replace the history list completely.
169*52ba75afSkettenis
170*52ba75afSkettenis@item -d @var{offset}
171*52ba75afSkettenisDelete the history entry at position @var{offset}.
172*52ba75afSkettenis@var{offset} should be specified as it appears when the history is
173*52ba75afSkettenisdisplayed.
174*52ba75afSkettenis
175*52ba75afSkettenis@item -a
176*52ba75afSkettenisAppend the new
177*52ba75afSkettenishistory lines (history lines entered since the beginning of the
178*52ba75afSketteniscurrent Bash session) to the history file.
179*52ba75afSkettenis
180*52ba75afSkettenis@item -n
181*52ba75afSkettenisAppend the history lines not already read from the history file
182*52ba75afSkettenisto the current history list.  These are lines appended to the history
183*52ba75afSkettenisfile since the beginning of the current Bash session.
184*52ba75afSkettenis
185*52ba75afSkettenis@item -r
186*52ba75afSkettenisRead the current history file and append its contents to
187*52ba75afSkettenisthe history list.
188*52ba75afSkettenis
189*52ba75afSkettenis@item -w
190*52ba75afSkettenisWrite out the current history to the history file.
191*52ba75afSkettenis
192*52ba75afSkettenis@item -p
193*52ba75afSkettenisPerform history substitution on the @var{arg}s and display the result
194*52ba75afSkettenison the standard output, without storing the results in the history list.
195*52ba75afSkettenis
196*52ba75afSkettenis@item -s
197*52ba75afSkettenisThe @var{arg}s are added to the end of
198*52ba75afSkettenisthe history list as a single entry.
199*52ba75afSkettenis
200*52ba75afSkettenis@end table
201*52ba75afSkettenis
202*52ba75afSkettenisWhen any of the @option{-w}, @option{-r}, @option{-a}, or @option{-n} options is
203*52ba75afSkettenisused, if @var{filename}
204*52ba75afSkettenisis given, then it is used as the history file.  If not, then
205*52ba75afSkettenisthe value of the @env{HISTFILE} variable is used.
206*52ba75afSkettenis
207*52ba75afSkettenis@end table
208*52ba75afSkettenis@end ifset
209*52ba75afSkettenis
210*52ba75afSkettenis@node History Interaction
211*52ba75afSkettenis@section History Expansion
212*52ba75afSkettenis@cindex history expansion
213*52ba75afSkettenis
214*52ba75afSkettenisThe History library provides a history expansion feature that is similar
215*52ba75afSkettenisto the history expansion provided by @code{csh}.  This section
216*52ba75afSkettenisdescribes the syntax used to manipulate the history information.
217*52ba75afSkettenis
218*52ba75afSkettenisHistory expansions introduce words from the history list into
219*52ba75afSkettenisthe input stream, making it easy to repeat commands, insert the
220*52ba75afSkettenisarguments to a previous command into the current input line, or
221*52ba75afSkettenisfix errors in previous commands quickly.
222*52ba75afSkettenis
223*52ba75afSkettenisHistory expansion takes place in two parts.  The first is to determine
224*52ba75afSketteniswhich line from the history list should be used during substitution.
225*52ba75afSkettenisThe second is to select portions of that line for inclusion into the
226*52ba75afSketteniscurrent one.  The line selected from the history is called the
227*52ba75afSkettenis@dfn{event}, and the portions of that line that are acted upon are
228*52ba75afSketteniscalled @dfn{words}.  Various @dfn{modifiers} are available to manipulate
229*52ba75afSkettenisthe selected words.  The line is broken into words in the same fashion
230*52ba75afSkettenisthat Bash does, so that several words
231*52ba75afSkettenissurrounded by quotes are considered one word.
232*52ba75afSkettenisHistory expansions are introduced by the appearance of the
233*52ba75afSkettenishistory expansion character, which is @samp{!} by default.
234*52ba75afSkettenis@ifset BashFeatures
235*52ba75afSkettenisOnly @samp{\} and @samp{'} may be used to escape the history expansion
236*52ba75afSkettenischaracter.
237*52ba75afSkettenis@end ifset
238*52ba75afSkettenis
239*52ba75afSkettenis@ifset BashFeatures
240*52ba75afSkettenisSeveral shell options settable with the @code{shopt}
241*52ba75afSkettenisbuiltin (@pxref{Bash Builtins}) may be used to tailor
242*52ba75afSkettenisthe behavior of history expansion.  If the
243*52ba75afSkettenis@code{histverify} shell option is enabled, and Readline
244*52ba75afSkettenisis being used, history substitutions are not immediately passed to
245*52ba75afSkettenisthe shell parser.
246*52ba75afSkettenisInstead, the expanded line is reloaded into the Readline
247*52ba75afSkettenisediting buffer for further modification.
248*52ba75afSkettenisIf Readline is being used, and the @code{histreedit}
249*52ba75afSkettenisshell option is enabled, a failed history expansion will be
250*52ba75afSkettenisreloaded into the Readline editing buffer for correction.
251*52ba75afSkettenisThe @option{-p} option to the @code{history} builtin command
252*52ba75afSkettenismay be used to see what a history expansion will do before using it.
253*52ba75afSkettenisThe @option{-s} option to the @code{history} builtin may be used to
254*52ba75afSkettenisadd commands to the end of the history list without actually executing
255*52ba75afSkettenisthem, so that they are available for subsequent recall.
256*52ba75afSkettenisThis is most useful in conjunction with Readline.
257*52ba75afSkettenis
258*52ba75afSkettenisThe shell allows control of the various characters used by the
259*52ba75afSkettenishistory expansion mechanism with the @code{histchars} variable.
260*52ba75afSkettenis@end ifset
261*52ba75afSkettenis
262*52ba75afSkettenis@menu
263*52ba75afSkettenis* Event Designators::	How to specify which history line to use.
264*52ba75afSkettenis* Word Designators::	Specifying which words are of interest.
265*52ba75afSkettenis* Modifiers::		Modifying the results of substitution.
266*52ba75afSkettenis@end menu
267*52ba75afSkettenis
268*52ba75afSkettenis@node Event Designators
269*52ba75afSkettenis@subsection Event Designators
270*52ba75afSkettenis@cindex event designators
271*52ba75afSkettenis
272*52ba75afSkettenisAn event designator is a reference to a command line entry in the
273*52ba75afSkettenishistory list.
274*52ba75afSkettenis@cindex history events
275*52ba75afSkettenis
276*52ba75afSkettenis@table @asis
277*52ba75afSkettenis
278*52ba75afSkettenis@item @code{!}
279*52ba75afSkettenisStart a history substitution, except when followed by a space, tab,
280*52ba75afSkettenisthe end of the line, @samp{=} or @samp{(}.
281*52ba75afSkettenis
282*52ba75afSkettenis@item @code{!@var{n}}
283*52ba75afSkettenisRefer to command line @var{n}.
284*52ba75afSkettenis
285*52ba75afSkettenis@item @code{!-@var{n}}
286*52ba75afSkettenisRefer to the command @var{n} lines back.
287*52ba75afSkettenis
288*52ba75afSkettenis@item @code{!!}
289*52ba75afSkettenisRefer to the previous command.  This is a synonym for @samp{!-1}.
290*52ba75afSkettenis
291*52ba75afSkettenis@item @code{!@var{string}}
292*52ba75afSkettenisRefer to the most recent command starting with @var{string}.
293*52ba75afSkettenis
294*52ba75afSkettenis@item @code{!?@var{string}[?]}
295*52ba75afSkettenisRefer to the most recent command containing @var{string}.  The trailing
296*52ba75afSkettenis@samp{?} may be omitted if the @var{string} is followed immediately by
297*52ba75afSkettenisa newline.
298*52ba75afSkettenis
299*52ba75afSkettenis@item @code{^@var{string1}^@var{string2}^}
300*52ba75afSkettenisQuick Substitution.  Repeat the last command, replacing @var{string1}
301*52ba75afSketteniswith @var{string2}.  Equivalent to
302*52ba75afSkettenis@code{!!:s/@var{string1}/@var{string2}/}.
303*52ba75afSkettenis
304*52ba75afSkettenis@item @code{!#}
305*52ba75afSkettenisThe entire command line typed so far.
306*52ba75afSkettenis
307*52ba75afSkettenis@end table
308*52ba75afSkettenis
309*52ba75afSkettenis@node Word Designators
310*52ba75afSkettenis@subsection Word Designators
311*52ba75afSkettenis
312*52ba75afSkettenisWord designators are used to select desired words from the event.
313*52ba75afSkettenisA @samp{:} separates the event specification from the word designator.  It
314*52ba75afSkettenismay be omitted if the word designator begins with a @samp{^}, @samp{$},
315*52ba75afSkettenis@samp{*}, @samp{-}, or @samp{%}.  Words are numbered from the beginning
316*52ba75afSkettenisof the line, with the first word being denoted by 0 (zero).  Words are
317*52ba75afSkettenisinserted into the current line separated by single spaces.
318*52ba75afSkettenis
319*52ba75afSkettenis@need 0.75
320*52ba75afSkettenisFor example,
321*52ba75afSkettenis
322*52ba75afSkettenis@table @code
323*52ba75afSkettenis@item !!
324*52ba75afSkettenisdesignates the preceding command.  When you type this, the preceding
325*52ba75afSketteniscommand is repeated in toto.
326*52ba75afSkettenis
327*52ba75afSkettenis@item !!:$
328*52ba75afSkettenisdesignates the last argument of the preceding command.  This may be
329*52ba75afSkettenisshortened to @code{!$}.
330*52ba75afSkettenis
331*52ba75afSkettenis@item !fi:2
332*52ba75afSkettenisdesignates the second argument of the most recent command starting with
333*52ba75afSkettenisthe letters @code{fi}.
334*52ba75afSkettenis@end table
335*52ba75afSkettenis
336*52ba75afSkettenis@need 0.75
337*52ba75afSkettenisHere are the word designators:
338*52ba75afSkettenis
339*52ba75afSkettenis@table @code
340*52ba75afSkettenis
341*52ba75afSkettenis@item 0 (zero)
342*52ba75afSkettenisThe @code{0}th word.  For many applications, this is the command word.
343*52ba75afSkettenis
344*52ba75afSkettenis@item @var{n}
345*52ba75afSkettenisThe @var{n}th word.
346*52ba75afSkettenis
347*52ba75afSkettenis@item ^
348*52ba75afSkettenisThe first argument; that is, word 1.
349*52ba75afSkettenis
350*52ba75afSkettenis@item $
351*52ba75afSkettenisThe last argument.
352*52ba75afSkettenis
353*52ba75afSkettenis@item %
354*52ba75afSkettenisThe word matched by the most recent @samp{?@var{string}?} search.
355*52ba75afSkettenis
356*52ba75afSkettenis@item @var{x}-@var{y}
357*52ba75afSkettenisA range of words; @samp{-@var{y}} abbreviates @samp{0-@var{y}}.
358*52ba75afSkettenis
359*52ba75afSkettenis@item *
360*52ba75afSkettenisAll of the words, except the @code{0}th.  This is a synonym for @samp{1-$}.
361*52ba75afSkettenisIt is not an error to use @samp{*} if there is just one word in the event;
362*52ba75afSkettenisthe empty string is returned in that case.
363*52ba75afSkettenis
364*52ba75afSkettenis@item @var{x}*
365*52ba75afSkettenisAbbreviates @samp{@var{x}-$}
366*52ba75afSkettenis
367*52ba75afSkettenis@item @var{x}-
368*52ba75afSkettenisAbbreviates @samp{@var{x}-$} like @samp{@var{x}*}, but omits the last word.
369*52ba75afSkettenis
370*52ba75afSkettenis@end table
371*52ba75afSkettenis
372*52ba75afSkettenisIf a word designator is supplied without an event specification, the
373*52ba75afSkettenisprevious command is used as the event.
374*52ba75afSkettenis
375*52ba75afSkettenis@node Modifiers
376*52ba75afSkettenis@subsection Modifiers
377*52ba75afSkettenis
378*52ba75afSkettenisAfter the optional word designator, you can add a sequence of one or more
379*52ba75afSkettenisof the following modifiers, each preceded by a @samp{:}.
380*52ba75afSkettenis
381*52ba75afSkettenis@table @code
382*52ba75afSkettenis
383*52ba75afSkettenis@item h
384*52ba75afSkettenisRemove a trailing pathname component, leaving only the head.
385*52ba75afSkettenis
386*52ba75afSkettenis@item t
387*52ba75afSkettenisRemove all leading  pathname  components, leaving the tail.
388*52ba75afSkettenis
389*52ba75afSkettenis@item r
390*52ba75afSkettenisRemove a trailing suffix of the form @samp{.@var{suffix}}, leaving
391*52ba75afSkettenisthe basename.
392*52ba75afSkettenis
393*52ba75afSkettenis@item e
394*52ba75afSkettenisRemove all but the trailing suffix.
395*52ba75afSkettenis
396*52ba75afSkettenis@item p
397*52ba75afSkettenisPrint the new command but do not execute it.
398*52ba75afSkettenis
399*52ba75afSkettenis@ifset BashFeatures
400*52ba75afSkettenis@item q
401*52ba75afSkettenisQuote the substituted words, escaping further substitutions.
402*52ba75afSkettenis
403*52ba75afSkettenis@item x
404*52ba75afSkettenisQuote the substituted words as with @samp{q},
405*52ba75afSkettenisbut break into words at spaces, tabs, and newlines.
406*52ba75afSkettenis@end ifset
407*52ba75afSkettenis
408*52ba75afSkettenis@item s/@var{old}/@var{new}/
409*52ba75afSkettenisSubstitute @var{new} for the first occurrence of @var{old} in the
410*52ba75afSkettenisevent line.  Any delimiter may be used in place of @samp{/}.
411*52ba75afSkettenisThe delimiter may be quoted in @var{old} and @var{new}
412*52ba75afSketteniswith a single backslash.  If @samp{&} appears in @var{new},
413*52ba75afSkettenisit is replaced by @var{old}.  A single backslash will quote
414*52ba75afSkettenisthe @samp{&}.  The final delimiter is optional if it is the last
415*52ba75afSkettenischaracter on the input line.
416*52ba75afSkettenis
417*52ba75afSkettenis@item &
418*52ba75afSkettenisRepeat the previous substitution.
419*52ba75afSkettenis
420*52ba75afSkettenis@item g
421*52ba75afSkettenisCause changes to be applied over the entire event line.  Used in
422*52ba75afSkettenisconjunction with @samp{s}, as in @code{gs/@var{old}/@var{new}/},
423*52ba75afSkettenisor with @samp{&}.
424*52ba75afSkettenis
425*52ba75afSkettenis@end table
426