I was playing around with
sed after answering another question and I noticed that
.* are not giving the same result when they both match multiple characters in a context address.
The following command1:
sed -E '$!N;/(.+)\n\1/!P;D' <<IN one one_more two two_more IN
OK, that's the expected output.
Changing the regex from
.* (i.e. from one or more characters to zero or more characters) should give the same result but it does not:
sed -E '$!N;/(.*)\n\1/!P;D' <<IN one one_more two two_more IN
prints just one line
What's going on here ?
1: I'm using ERE for simplicity/readability, the same happens when using BRE