Fix the substitution print subcommand, it should only print if its
authorGlenn L McGrath <bug1@ihug.co.nz>
Sat, 30 Aug 2003 04:35:07 +0000 (04:35 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Sat, 30 Aug 2003 04:35:07 +0000 (04:35 -0000)
own substitution matched, not previous ones.
e.g
echo fooba | sed -n 's/foo//;s/bar/found/p'
shouldnt print anything

editors/sed.c

index 6beba0661893edae23b60811193dda4cbee92164..b06d5a8d8948b6625507be15f3870bf2a66f22ec 100644 (file)
@@ -839,7 +839,6 @@ static void process_file(FILE * file)
                                still_in_range || ((sed_cmd->beg_line == -1)
                                        && (next_line == NULL))
                                );
-
                        if (sed_cmd->cmd == '{') {
                                block_mask = block_mask & matched;
                        }
@@ -925,7 +924,7 @@ static void process_file(FILE * file)
                                                }
                                        }
 #endif
-                                       altered |= substituted;
+                                       altered = substituted;
                                        if (!be_quiet && altered && ((sed_cmd->next == NULL)
                                                        || (sed_cmd->next->cmd != 's'))) {
                                                force_print = 1;