Name

sed

Synopsis

    sed [options] [files]

Stream editor. Edit one or more files without user interaction. See Chapter 10 for more information on sed. The -e and -f options may be provided multiple times, and they may be used with each other. See also sed & awk, cited in the Bibliography.

Common Options

-e'instruction', --expression='instruction'

Apply the editing instruction to the files.

-fscript, --file=script

Apply the set of instructions from the editing script.

-n, --quiet, --silent

Suppress default output.

GNU/Linux and Mac OS X Option

-i[suffix], --in-place=[suffix]

Edit files in place, saving each original in a file created by concatenating suffix to the filename. A zero length suffix does not save a backup copy; this is not recommended.

GNU/Linux Options

-lcount, --line-length=count

Wrap lines at column count for the l command.

--posix

Disable all GNU extensions.

-r, --regex-extended

Use Extended Regular Expressions instead of Basic Regular Expressions (see Chapter 7).

-s, --separate

Process each file separately instead of treating them all as one long input stream.

-u, --unbuffered

Do not keep as much data in memory as sed would normally; flush output buffers more often.

Mac OS X Option

-E

Use Extended Regular Expressions instead of Basic Regular Expressions (see Chapter 7).

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.