.! .! File: SED.RNH .! .! Author: Hunter Goatley .! .! Date: October 14, 1991 .! .! Description: .! .! RUNOFF source file for GNU sed on-line help. .! .! To build: $ RUNOFF SED.RNH .! $ LIBR/HELP/INSERT libr SED .! .! Modification history: .! .! 01-001 Hunter Goatley 14-OCT-1991 08:21 .! Genesis. .! .noflags .lm4 .rm72 .indent -4 1 SED .br SED is GNU sed, the Free Software Foundation's implementation of sed, the UN*X stream text editor. The command syntax is UN*X-like, not VMS-like. .sk Sed reads one line at a time from the input files. It applies the commands from the list, in order, to each line and writes the edited line to SYS$OUTPUT. The default input file is SYS$INPUT. The script of editing commands can be given on the command line or placed in a file. The -f option causes the script to be taken from the named file. .sk Note that UN*X-style indirection can be used for redirecting SYS$INPUT and SYS$OUTPUT. .sk Sed outputs each line automatically (unless -n is given). If the list of sed commands appears on the command line, quotes may be necessary to maintain the proper case. .sk Format: .sk;.lm+1;.literal sed [-options] [list of sed commands] [files...] .end literal;.lm-1 .!------------------------------------------------------------------------------ .indent -4 2 Command_Format .br A script consists of editing commands, one per line, of the following form: .sk;.center [address [, address] ] function [arguments] .sk In essence, sed copies each line to a buffer and applies each command in sequence to that line. When the list is exhausted, the edited line is written to SYS$OUTPUT (unless -n was given). .sk An address can be one of the following: .sk;.list 0,"o" .le;a decimal line number (line numbers are counted across input files; the line counter is not reset when a new file is opened); .le;a "$" that refers to the last line of input; .le;a pattern containing a grep-style regular expression; if the pattern matches the line, the command is applied to the line. .end list A command line with no addresses matches every line, while a command line with one address selects each line that matches the address. A command line with two addresses selects the inclusive range from the first line that matches the first address to the line that matches the second address. .sk The "!" function can be used to apply a command only to lines that do not match a pattern. .!------------------------------------------------------------------------------ .indent -4 2 List_of_Commands .br The valid sed commands include: .sk .literal a\ append lines to output until one not ending in \ b