/pattern/= write out the line number of line containing pattern [address1][,address2]l list the selected lines showing non-printing characters as ASCII codes. [address1][,address2]p print the selected lines. If "-n" flag has not been set then you will see two copies. ------------------------------------------------------------------------ [address1][,address2]n Output pattern space. Read next line into pattern space. Control passes to the next command. [address1][,address2]d Read in selected line. Delete pattern space. No output. A new line is read. PROCESSING BEGINS WITH THE FIRST COMMAND OF THE SCRIPT. [address1][,address2]s/pattern/replacement/[flags] Substitute "replacement" for "pattern" on each selected line. If pattern addresses are used then "//" represents the last pattern address. n ... replace the "n"th instance (default is 1) g ... replace all instances p ... print the pattern space only if substitution is successful w FILENAME (write line to FILENAME; see below) ------------------------------------------------------------------------ [address]a\ text\ text Append "text" after (below) the address. The last line of "text" has no "\" "text" not available for proecssing. [address]i\ text\ text Insert "text" before (above) the address. The last line of "text" has no "\" "text" not available for proecssing. [address1][,address2]c\ text\ text Replace the selected lines by "text". The last line of "text" has no "\" "text" not available for proecssing. [address]r FILENAME Read contents of FILENAME and append after the contents of the pattern space. These new contents cannot be edited. Exactly one blank space between "r" and FILENAME. [address]w FILENAME Append contents of pattern space to FILENAME. This action happens as soon as the command is encountered. Exactly one blank space between "r" and FILENAME. ------------------------------------------------------------------------ [address]q On encountering address: finish all processing, output the pattern space and then quit. :label upto 7-characters for label [address1][,address2]b[label] Skip unconditionally to label [address1][,address2]t [label] skip to label if previous substitution was successful. ------------------------------------------------------------------------ MULTI-LINE: In addition to pattern space there is a "hold space". [address1][,address2]h copy pattern to hold space. [address1][,address2]H append pattern space to hold space (with an EOF separator) [address1][,address2]g replace pattern space with hold space [address1][,address2]G append to pattern space the hold space (with an EOF separator) [address1][,address2]D Delete first part of pattern space (to EOF) CONTROL GOES TO THE TOP OF THE SCRIPT [address1][,address2]P Print first part of pattern space (to EOF) [address1][,address2] Swap pattern space and hold space The EOF can searched by looking for "\n".