on each addressed line. If pattern addresses are used, the pattern
represents the last pattern address specified. Any delimiter may be used. Use
to escape the delimiter. The following flags can be specified:
Replace all instances of pattern
on each addressed line, not just the first instance.
Print the line if a successful substitution is done. If several successful substitutions are done, sed
prints multiple copies of the line.
Write the line to file
if a replacement was done. A maximum of 10 different files
can be opened.
th instance of pattern
on each addressed line. n
is any number in the range 1 to 512, and the default is 1.
Here are some short, commented scripts:
# Change third and fourth quote to ( and ):
# Remove all quotes on a given line:
# Remove first colon and all quotes; print resulting lines:
# Change first "if" but leave "ifdef" alone: