Linux in a Nutshell, Third Edition
by Ellen Siever, Stephen Spainhour, Jessica P. Hekman, Stephen Figgins
Command-Line Syntax
The syntax for invoking sed has two forms:
sed [options] 'command' file(s) sed [options] -f scriptfile file(s)
The first form allows you to specify an editing command on the command line, surrounded by single quotes. The second form allows you to specify a scriptfile, a file containing sed commands. If no files are specified, sed reads from standard input.
The following options are recognized:
- -e cmd
Next argument is an editing command; not needed unless specifying two or more editing commands.
- -f scriptfile
Next argument is a file containing editing commands.
- -n
Suppress the default output; sed displays only those lines specified with the p command or with the p flag of the s command.
- -V
Display version number.
- --quiet
Same as -n.
- --expression= cmd
Same as -e.
- --file= file
Same as -f.
- --help
Display brief help message with command-line options.
- --silent
Same as -n.
- --version
Same as -V.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access