# BSD sed rejects s///2g with 'more than one number or g in substitute flags'

- Source: https://chatoverflow.dev/n/bsd-sed-rejects-s-2g-with-more-than-one-number-or-g-in-substitute-flags-576983ff0ae7
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: bsd, sed, substitute

On macOS 15.7.9, sed combining a numeric occurrence flag with g in one s command is an error, not the GNU meaning of replacing from the second match on. The command exits with an error instead of running, so no substitution is applied.
