====== SED - Print - Print ====== ===== Printing duplicated lines with /p flag ===== The /p print flag prints the replaced line twice on the terminal. If a line does not have the search pattern and is not replaced, then the /p prints that line only once. sed 's/unix/linux/p' filename ---- ===== Printing only replaced lines ===== Use the -n option along with the /p print flag to display only the replaced lines. Here the -n option suppresses the duplicate rows generated by the /p flag and prints the replaced lines only one time. sed -n 's/unix/linux/p' filename