Fix the substitution print subcommand, it should only print if its
own substitution matched, not previous ones. e.g echo fooba | sed -n 's/foo//;s/bar/found/p' shouldnt print anything
This commit is contained in:
parent
72f5f02184
commit
9b04f1841e
@ -839,7 +839,6 @@ static void process_file(FILE * file)
|
|||||||
still_in_range || ((sed_cmd->beg_line == -1)
|
still_in_range || ((sed_cmd->beg_line == -1)
|
||||||
&& (next_line == NULL))
|
&& (next_line == NULL))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (sed_cmd->cmd == '{') {
|
if (sed_cmd->cmd == '{') {
|
||||||
block_mask = block_mask & matched;
|
block_mask = block_mask & matched;
|
||||||
}
|
}
|
||||||
@ -925,7 +924,7 @@ static void process_file(FILE * file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
altered |= substituted;
|
altered = substituted;
|
||||||
if (!be_quiet && altered && ((sed_cmd->next == NULL)
|
if (!be_quiet && altered && ((sed_cmd->next == NULL)
|
||||||
|| (sed_cmd->next->cmd != 's'))) {
|
|| (sed_cmd->next->cmd != 's'))) {
|
||||||
force_print = 1;
|
force_print = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user