I use the sed
command on macOS with the following text:
$ cat pets.txt
This is my cat
my cat\'s name is betty
This is your dog
your dog\'s name
Mac OS X uses BSD sed
and not GNU sed
.
When you use a GNU sed
extension with Mac OS X sed
, you get different results, or failures.
Classically, sed
does not support numeric offsets, forwards or backwards. You'll need to revise your script to work on Mac OS X.
This would work on the given data, but the use of fish
is suspect:
sed '/dog/,/your fish/s/^/# /g' pets.txt