Actually, it seems to be the "s///p" form (print *if* a substitution was done) that IRIX sed is treating differently, and only when it's followed by more modifications to the pattern space, printing, etc. I believe the substitutions are arranged to always be performed, so using a separate print command seems to be a reasonable change, and it gets me the same results using IRIX and GNU sed.