There were a couple of issues
- `paste` requires a file argument
- `mktemp` requires a pattern argument
- `sort` doesn't support `-h`, but `-n` is enough for sorting on numbers, and `-s` was introduced to perform a stable sort instead.
The main issues were that BSD `sed` does not support:
- Alternation (`\|`) - solved by splitting to multiple patterns
- Bound shortcuts (`x\+`, `x\?`) - solved by replacing with `xx*` and `x\{0,1\}` respectively
- Lower-casing (`\L`) - solved by piping through `tr` instead (this will lowercase everything and not only the integration names, but I assumed that wasn't too much of an issue, as a portable alternative for the selective downcasing would be much more involved).