lines data file
The following examples use the lines file for input:
$ cat linesLine one.The second line.The third.This is line four.Five.This is the sixth sentence.This is line seven.Eighth and last.
Unless you instruct it not to, sed sends all lines—selected or not—to standard output. When you use the –n option on the command line, sed sends only certain lines, such as those selected by a Print (p) instruction, to standard output.
The following command line displays all lines in the lines file that contain the word line (all lowercase). In addition, because there is no –n option, sed displays all the lines of input. As a result, sed displays the lines that contain the word line twice.
$ sed '/line/ p' linesLine one.The second line. ...