newline must be part of the pattern space i.e. `echo a|sed -e P' must print a a and not aa This is consistent with gnu sed, SunOS, Ultrix (and probably others!)