Substitute the first match per line, then every match
Substitute the first match per line, then every match
Answer
sed 's/port/PORT/' relay.conf sed 's/port/PORT/g' relay.conf
One character apart, and only line 4 of the fixture differs between the two outputs, because it is the only line containing the word twice. Without g, s replaces the first match on each line and moves on.
POSIX.1-2024 (IEEE Std 1003.1-2024) Shell and Utilities: sed. The textbook names sed as a regex tool and never teaches it.