\vTITLE="SED PDA Reference Card"\v \c\B\lSED PDA Reference Card\l\B\c \cSED, A Stream-oriented Editor\c \c[Condensed from:\c \cSed & Awk Pocket Reference\c \cİ 2000; by Arnold Robbins;\c \cISBN: 1-56592729-X ]\c \cby Jesus Monroy, Jr. (didgood.com)\c \p\BNOTE:\B sed has two (2) internal buffers - "pattern space" (p-space) and "hold space" (h-space). \p\BCommand-Line Syntax\B sed [-n] [-e] 'command' file(s) sed [-n] -f scriptfile file(s) \p\c\BSyntax of Commands\B\c \Bgeneral form:\B [addr[,addr]][!] cmd [arg] "addr" can be a line number, a symbol or a regular expression. "cmd" - commands as listed below. "arg" - apply only to certain commands (b, t, r, w & s). \Bmulti-command form:\B [/pattern/[,/pattern/]] [!]{ cmd1 cmd2 } \p\c\BExamples\B\c s/xx/yy/g subs. all lines (all occurrences) /BSD/d delete lines containing BSD /^BEGIN/,/^END/p print between BEGIN & END, incl. /SAVE/!d delete lines without SAVE /BEGIN/,/END/!s/xx/yy/g subs. all lines, except between \p\c\BGroup Summary\B\c \BBasic editing\B a\\ append after line c\\ replace (usually block) i\\ insert before line d delete s substitution y translate chars (like tr) \BLine information\B = line number l control chars (ASCII) p entire line(s) (or bound line) \BInput/output processing\B n output current, get next r read another file to p-space w write to another file q quit now! \BYanking and putting\B h copy & overwrite h-space H copy & append h-space g get h-space & overwrite G get h-space & append x eXchange h-space & p-space \BBranching commands\B b branch to label or end t substitute, then branch :label label to branch to \BMultiline input processing\B N append next line to p-space D delete 1st part of p-space P print 1st part of p-space \p\BAlphabetic Summary\B # comment, except #n : label to branch to = line number a append after line b branch to label or end c replace (usually block) d delete D delete 1st part of p-space g get h-space & overwrite G get h-space & append h copy & overwrite h-space H copy & append h-space i insert before line l control chars (ASCII) n output current, get next N append next line to p-space p entire line(s) (or bound line) P print 1st part of p-space q quit now! r read another file to p-space s substitution t substitute, then branch w write to another file x eXchange h-space & p-space y translate chars (like tr)