By default, the action of the sed command is to print the pattern space, such as every line that is copied into the buffer, and then print the result of processing it. Therefore, the sed output will consist of all lines along with the processed line by sed. If we do not want the default pattern space line to be printed, then we need to give the -n option. Therefore, we should use the -n option and the p command together to see the result of the sed processed output.
Here is an example:
$ cat country.txt
The output is as follows:
Country Capital ISD Code USA Washington 1 China Beijing 86 Japan Tokyo 81 India Delhi 91 $ sed '/USA/p' country.txt
The output is as follows:
Country Capital ISD Code USA Washington 1 ...