SED(1) User Commands SED(1)
NAME
sed - stream editor for filtering and transforming text
SYNOPSIS
sed [‐V] [‐‐version] [‐‐help] [‐n] [‐‐quiet] [‐‐silent]
[‐l N] [‐‐line‐length=N] [‐u] [‐‐unbuffered]
[‐E] [‐r] [‐‐regexp‐extended]
[‐e script] [‐‐expression=script]
[‐f script‐file] [‐‐file=script‐file]
[script‐if‐no‐other‐script]
[file...]
DESCRIPTION
Sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
While in some ways similar to an editor which permits scripted edits
(such as ed), sed works by making only one pass over the input(s), and
is consequently more efficient. But it is sed’s ability to filter text
in a pipeline which particularly distinguishes it from other types of
editors.
-n, --quiet, --silent
suppress automatic printing of pattern space
--debug
annotate program execution
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
--follow-symlinks
follow symlinks when processing in place
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if SUFFIX supplied)
-l N, --line-length=N
specify the desired line-wrap length for the ‘l’ command
--posix
disable all GNU extensions.
-E, -r, --regexp-extended
use extended regular expressions in the script (for portability
use POSIX -E).
-s, --separate
consider files as separate rather than as a single, continuous
long stream.
--sandbox
operate in sandbox mode (disable e/r/w commands).
-u, --unbuffered
load minimal amounts of data from the input files and flush the
output buffers more often
-z, --null-data
separate lines by NUL characters
--help
display this help and exit
--version
output version information and exit
If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All re‐
maining arguments are names of input files; if no input files are speci‐
fied, then the standard input is read.
GNU sed home page: <https://www.gnu.org/software/sed/>. General help
using GNU software: <https://www.gnu.org/gethelp/>. E-mail bug reports
to: <bug-sed@gnu.org>.
Packaged by Debian Copyright © 2022 Free Software Foundation, Inc. Li‐
cense GPLv3+: GNU GPL version 3 or later <https://gnu.org/li‐
censes/gpl.html>. This is free software: you are free to change and re‐
distribute it. There is NO WARRANTY, to the extent permitted by law.
COMMAND SYNOPSIS
This is just a brief synopsis of sed commands to serve as a reminder to
those who already know sed; other documentation (such as the texinfo
document) must be consulted for fuller descriptions.
Zero‐address ‘‘commands’’
: label
Label for b and t commands.
#comment
The comment extends until the next newline (or the end of a -e
script fragment).
} The closing bracket of a { } block.
Zero‐ or One‐ address commands
= Print the current line number.
a \
text Append text, which has each embedded newline preceded by a back‐
slash.
i \
text Insert text, which has each embedded newline preceded by a back‐