Why the dash in foo-baz
is not replaced?
1)The s/-/_/g
command operates line by line before all lines are appended by N
.
2)The second line (foo-baz
) has dash not replaced yet while being appended.
3)The replacement command does not rerun on the combined, newline-removed string.
The
s/-/_/g
command operates line by line before all lines are appended byN
.The second line (
foo-baz
) has dash not replaced yet while being appended.The replacement command does not rerun on the combined, newline-removed string.
Result: the dash remains in the final joined output.