The greedy behaviour of a sed
substitution command will by default substitute first match occurrence on every line. For example:
$ cat text bash bash bash bash bash bash bash bash bash $ sed 's/bash/sed/' text sed bash bash sed bash bash sed bash bash
The following linux command will substitute only a first occurrence of string bash
to a string sed
:
$ sed '0,/bash/s//sed/' text sed bash bash bash bash bash bash bash bash