sed Commands Command Function a\ Appends one or more lines of text to the current line c\ Changes (replaces) text in the current line with new text d Deletes lines i\ Inserts text above the current line h Copies the contents of the pattern space to a holding buffer H Appends the contents of the pattern space to a holding buffer g Gets what is in the holding buffer and copies it into the pattern buffer, overwriting what was there G Gets what is in the holding buffer and copies it into the pattern buffer, appending to what was there l Lists nonprinting characters p Prints lines n Reads the next input line and starts processing the newline with the next command rather than the first command q Quits or exits sed r Reads lines from a file ! Applies the command to all lines except the selected ones s Substitutes one string for another Substitution Flags g Globally substitutes on a line p Prints lines w Writes lines out to a file x Exchanges contents of the holding buffer with the pattern space y Translates one character to another (cannot use regular expression metacharacters with y)