Use bin/env bash in shellbang for crossplatform compatibility
Determine GNU or BSD sed version to use according extended regex option