Per the POSIX standard's page on sed
:
The script shall consist of editing commands of the following form:
[address[,address]]function
where function
represents a single-character command verb from the list in
Editing Commands in sed, followed by any applicable arguments.
So the first non-blank character after the address is taken as a command verb - in your particular case it's /
hence the error: char 9: unknown command: '/'
.
The braces are referenced further down:
[2addr] {editing command
editing command
...
}
Execute a list of `sed` editing commands only when the pattern space is selected. …
[2addr] is an indicator that the maximum number of permissible addresses is two.
To clarify a point made above, the Addresses section of sed(1)
says:
Sed
commands can be given with no addresses,
in which case the command will be executed for all input lines;
with one address, in which case the command will be executed only
for input lines which match that address;
or with two addresses, in which case the command will be executed
for all input lines which match the inclusive range of lines
starting from the first address and continuing to the second address.
Three things to note about address ranges:
the syntax is addr1,addr2 (i.e., the addresses are separated by a comma);
… (and other stuff not relevant to this discussion) …
The gnu info page (info sed
) has a similar description of {
and }
,
under "3.4 Often-Used Commands":
{ COMMANDS }
A group of commands may be enclosed
between {
and }
characters.
This is particularly useful when you want a group of commands to be triggered
by a single address (or address-range) match.
Otherwise said, braces are used to apply multiple commands at the same address or to nest addresses.
The standard isn't very explicit here1 but the left brace {
is actually a command that starts a group of other sed commands (the group ends with a right brace }
).
And, at the risk of really going TL;DR, the issue is
that 195
, 210
, and /add/
are all addresses.
No sed
commands can be invoked with three addresses.
So the way to make your command work
is to invoke the {
command on the address range 195,210
,
and then (within that range) invoke the p
command on the address /add/
.
1:
though if you read the entire page it is mentioned that:
Command verbs other than {, a, b, c, i, r, t, w, :, and # can be followed by...