sed on mac: 'extra characters after p command'
Additionally, if you happen to get this error when using the -i
option without an extension:
> sed -i 's/foo/bar/g' file
sed: 1: "file": extra characters at the end of p command
In this case the solution is to explicitly set the extension to an empty string:
> sed -i '' 's/foo/bar/g' file
Add an extra semi-colon after the last p
sed -n '/\[test\]/{n;p;n;p;}' my-file
(not related to Mac version, also fails on MSYS)