DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Manipulating text with sed

Using sed

sed reads its standard input a line at a time, carries out whatever editing changes are specified, then writes the changed lines to its output. It acts as a filter on the input file, which streams through it.

To use sed, you need to specify the name of the command file that contains your editing script, then the file or files that you are processing. For example:

sed -f editscript <inputfile >outputfile
sed -e "/Hello/s/Hello/Hi/g" <letter.old >letter.new

Three optional flags are recognized on the command line:


-n
Directs sed to copy only those lines specified by p functions or p flags after s functions. See ``Whole-line oriented functions'' for details.

-e
Indicates that the next argument is an editing command.

-f
Indicates that the next argument is the name of the file which contains editing commands, typed one to a line.

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004