home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

10.2 Command-Line Syntax

The syntax for invoking sed has two forms:

sed [-n] [-e] 'command
' file(s)

sed [-n]  -f  scriptfile

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. Both forms may be used together, and they may be used multiple times. If no file(s) are specified, sed reads from standard input.

The following options are recognized:


Suppress the default output; sed displays only those lines specified with the p command or with the p flag of the s command.

-e cmd

Next argument is an editing command. Useful if multiple scripts or commands are specified.

-f file

Next argument is a file containing editing commands.

If the first line of the script is #n , sed behaves as if -n had been specified.

Previous: 10.1 Conceptual Overview UNIX in a Nutshell: System V Edition Next: 10.3 Syntax of sed Commands
10.1 Conceptual Overview Book Index 10.3 Syntax of sed Commands

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System