These commands work as expected: Case 1, 2:
$ printf "a\nb\nc\n" | sed -n '/a/ p'
a
$ printf "a\nb\na\n" | sed -n '/a/,/a/ p'
a
b
a
however I expected the following command to match only 'a', and I'm having trouble understanding the documented definition of two address ranges:
Case 3, 4:
$ printf "a\nb\nc\n" | sed -n '/a/,/a/ p'
a
b
c
$ printf "a\nb\nc\n" | sed -n '/b/,/b/ p'
b
c
Can anyone further explain this the behavior of this definition?
SED Command: [addr[,addr]f[args]
$ man sed
"...In the case when the second address is a context address, sed does not re-match the second address against the pattern space that matched the first address. Starting at the first line following the selected range, sed starts looking again for the first address..."
Thanks